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){
}
About Question com.enthuware.ets.scjp.v6.2.268 :
Moderators: Site Manager, fjwalraven
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.268 :
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.
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.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 58 guests