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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

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 »

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: 8855
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
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 »

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 »

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 »

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: Bing [Bot] and 1 guest