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
- 
				admin
 - Site Admin
 - Posts: 10443
 - 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.
Who is online
Users browsing this forum: No registered users and 10 guests