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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

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

Post 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){
}

admin
Site Admin
Posts: 10062
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 24 guests