About Question enthuware.ocajp.i.v7.2.940 :

Moderator: admin

Post Reply
baptize
Posts: 32
Joined: Wed Mar 14, 2012 5:45 pm
Contact:

About Question enthuware.ocajp.i.v7.2.940 :

Post by baptize » Wed Mar 14, 2012 8:19 pm

this code compiles just fine, if you try to insert
System.out.println(c); right after int c; then compilation will fail.

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

Re: About Question enthuware.ocajp.i.v7.2.940 :

Post by admin » Thu Mar 15, 2012 5:29 am

That is correct and that is why option 5 (The code will compile and run without any problem. ) is marked as correct.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

baptize
Posts: 32
Joined: Wed Mar 14, 2012 5:45 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.940 :

Post by baptize » Thu Mar 15, 2012 4:54 pm

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 :shock:

diafour
Posts: 2
Joined: Tue Oct 09, 2012 11:20 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.940 :

Post by diafour » Tue Oct 09, 2012 11:37 am

Detailed explanation in Java Language Specification

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 :

Post by insider » Thu Apr 18, 2013 2:06 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests