What happens if you dont initialize an instance variable of any of the primitive types in Java?

Q

What happens if you dont initialize an instance variable of any of the primitive types in Java?

✍: Guest

A

Java by default initializes it to the default value for that primitive type. Thus an int will be initialized to 0, a boolean will be initialized to false.

2013-06-27, 1972👍, 0💬