DEVFYI - Developer Resource - FYI

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

Java Interview Questions and Answers (part 3)


(Continued from previous question...)

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

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.

(Continued on next question...)

Other Interview Questions