1.

What are the default values assigned to variables and instances in java?

Answer»
  • There are no default values ASSIGNED to the variables in java. We need to initialize the value before using it. OTHERWISE, it will throw a compilation error of (Variable might not be initialized). 
  • But for instance, if we create the object, then the default value will be initialized by the default constructor depending on the DATA type. 
  • If it is a reference, then it will be assigned to NULL
  • If it is numeric, then it will assign to 0.
  • If it is a BOOLEAN, then it will be assigned to false. Etc.


Discussion

No Comment Found