Page 1 of 1

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

Posted: Wed Nov 26, 2014 2:57 am
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?

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

Posted: Wed Nov 26, 2014 3:03 am
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.

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

Posted: Wed Mar 23, 2016 2:41 am
by Sergio
Could you explain while the line 3 does not compile?

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

Posted: Wed Mar 23, 2016 2:50 am
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.

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

Posted: Thu Nov 10, 2016 7:37 am
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.

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

Posted: Thu Dec 29, 2016 10:48 am
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

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

Posted: Thu Dec 29, 2016 12:37 pm
by admin
Updated the problem statement to: Identify correct statement(s) about the following code:

thank you for your feedback!

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

Posted: Tue Feb 21, 2017 2:51 pm
by AndaRO
I downloaded the last version and this question is not updated.

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

Posted: Tue Feb 21, 2017 10:15 pm
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.

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

Posted: Mon Mar 27, 2017 2:22 pm
by charlie brown
I can confirm that the question is updated and makes sense as it is now. Thanks for the valuable discussion.