kavan singh

kavan singh

1 Articles Published

Articles by kavan singh

1 articles

Can an int be null in Java?

kavan singh
kavan singh
Updated on 19-Sep-2024 928 Views

No, In Java int cannot be null. There are some primitive data types and int is the one of the primitive data types in Java programming. The default value for an int data type is 0 and it cannot not be null. The different primitive data types have their different default values, but the objects in Java can be null. There is no null reference concept for the primitive data types (such as int, float, etc.). Example For example, if you try to assign null to an int variable. It will generate an error. int myInt = null; How ...

Read More
Showing 1–1 of 1 articles
« Prev 1 Next »
Advertisements