Page 1 of 1
About Question enthuware.ocajp.i.v7.2.940 :
Posted: Wed Mar 14, 2012 8:19 pm
by baptize
this code compiles just fine, if you try to insert
System.out.println(c); right after int c; then compilation will fail.
Re: About Question enthuware.ocajp.i.v7.2.940 :
Posted: Thu Mar 15, 2012 5:29 am
by admin
That is correct and that is why option 5 (The code will compile and run without any problem. ) is marked as correct.
HTH,
Paul.
Re: About Question enthuware.ocajp.i.v7.2.940 :
Posted: Thu Mar 15, 2012 4:54 pm
by baptize
admin 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.
sorry, my bad. I'm stressed out
. I need to go and get the chill pill
Re: About Question enthuware.ocajp.i.v7.2.940 :
Posted: Tue Oct 09, 2012 11:37 am
by diafour
Detailed explanation in Java Language Specification
4.12.5. Initial Values of Variables
http://docs.oracle.com/javase/specs/jls ... jls-4.12.5
Re: About Question enthuware.ocajp.i.v7.2.940 :
Posted: Thu Apr 18, 2013 2:06 am
by insider
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.