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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
Deleted User 1713

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

Post by Deleted User 1713 »

Hi all

I think that the correct answer for this question is wrong. If I put this code into a class Test in Test.java and compile it, I only get a compilation error because of //1. Only after I correct //1 I get another compilation error for //3. So yes, both //1 and //3 are wrong and will eventually lead to a compilation error, but if the code is compiled as it is written in the question there will be only one error.

What are your thoughts on this?

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

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

Post by admin »

For the code to get compiled, two errors need to be fixed. Whether you compile it once or more than once is immaterial. In the real exam as well you should spot all the errors in this kind of questions.

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

Sergio
Posts: 7
Joined: Wed Mar 23, 2016 1:39 am
Contact:

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

Post by Sergio »

Could you explain while the line 3 does not compile?

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

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

Post by admin »

As mentioned in the explanation:
So 1_000_000 and 1000000 are actually same and you cannot have two case blocks with the same value. Therefore, the second case at //3 is invalid.
If you like our products and services, please help us by posting your review here.

josefoygun
Posts: 1
Joined: Thu Nov 10, 2016 7:32 am
Contact:

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

Post by josefoygun »

admin wrote:As mentioned in the explanation:
So 1_000_000 and 1000000 are actually same and you cannot have two case blocks with the same value. Therefore, the second case at //3 is invalid.
The Question was not "Mention all lines that will fail to compile." it is "What will the following code print?" therefore you can only get one compilation error and not two.

JavaJunky
Posts: 4
Joined: Wed Dec 14, 2016 11:07 pm
Contact:

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

Post by JavaJunky »

I agree with other folks, the answers are wrong, The correct answer should be //1. While both of them give the compilation error you need to get rid of one to get the another one. Question should be stated differently in order to pick ans //3 also

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

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

Post by admin »

Updated the problem statement to: Identify correct statement(s) about the following code:

thank you for your feedback!
If you like our products and services, please help us by posting your review here.

AndaRO
Posts: 31
Joined: Wed Feb 08, 2017 5:42 pm
Contact:

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

Post by AndaRO »

I downloaded the last version and this question is not updated.

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

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

Post by admin »

My mistake. I updated in 808 and didn't propagate the change in 803. Please download it again now. It should be updated now.

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

charlie brown
Posts: 3
Joined: Sat Oct 26, 2013 4:31 am
Contact:

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

Post by charlie brown »

I can confirm that the question is updated and makes sense as it is now. Thanks for the valuable discussion.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests