Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.268 :

Posted: Tue Feb 14, 2012 6:23 pm
by ETS User
Hi,

The correct answer saying "This questions tests your knowledge on the default values of uninitialized primitives and object references, . booleans are initialized to false, numeric types to 0 and object references to null. "

However, in real java compiler, it shows compiler error when you trying to use a uninitialized boolean, so I doubt the correctness of this explain.

//compile error
boolean b;
if(b){
}

Re: About Question com.enthuware.ets.scjp.v6.2.268 :

Posted: Wed Feb 15, 2012 2:42 pm
by admin
Hello,
Default initialization applies only to instance and class members and not for local variables.
The explanation should be enhanced to clarify this asap.

Thanks a lot for your feedback!
HTH,
Paul.