this code compiles just fine, if you try to insert
System.out.println(c); right after int c; then compilation will fail.
			
			
									
									
						About Question enthuware.ocajp.i.v7.2.940 :
Moderator: admin
- 
				baptize
 - Posts: 32
 - Joined: Wed Mar 14, 2012 5:45 pm
 - Contact:
 
- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.ocajp.i.v7.2.940 :
That is correct and that is why option 5 (The code will compile and run without any problem. ) is marked as correct.
HTH,
Paul.
			
			
									
									
						HTH,
Paul.
- 
				baptize
 - Posts: 32
 - Joined: Wed Mar 14, 2012 5:45 pm
 - Contact:
 
Re: About Question enthuware.ocajp.i.v7.2.940 :
sorry, my bad. I'm stressed outadmin wrote:That is correct and that is why option 5 (The code will compile and run without any problem. ) is marked as correct.
HTH,
Paul.
- 
				diafour
 - Posts: 2
 - Joined: Tue Oct 09, 2012 11:20 am
 - Contact:
 
Re: About Question enthuware.ocajp.i.v7.2.940 :
Detailed explanation in Java Language Specification
4.12.5. Initial Values of Variables
http://docs.oracle.com/javase/specs/jls ... jls-4.12.5
			
			
									
									
						4.12.5. Initial Values of Variables
http://docs.oracle.com/javase/specs/jls ... jls-4.12.5
- 
				insider
 - Posts: 29
 - Joined: Wed Apr 17, 2013 9:22 am
 - Contact:
 
Re: About Question enthuware.ocajp.i.v7.2.940 :
Nice mention, diafour. It's always useful to consult the JLS (although it's kinda hard to read) because it seems to be the only 100% truthful source in case of doubts.
			
			
									
									
						Who is online
Users browsing this forum: No registered users and 27 guests