About Question enthuware.ocajp.i.v7.2.1379 :
Moderators: Site Manager, fjwalraven
About Question enthuware.ocajp.i.v7.2.1379 :
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?
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?
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 7
- Joined: Wed Mar 23, 2016 1:39 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
Could you explain while the line 3 does not compile?
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
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.
-
- Posts: 1
- Joined: Thu Nov 10, 2016 7:32 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
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.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.
-
- Posts: 4
- Joined: Wed Dec 14, 2016 11:07 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
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
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
Updated the problem statement to: Identify correct statement(s) about the following code:
thank you for your feedback!
thank you for your feedback!
If you like our products and services, please help us by posting your review here.
-
- Posts: 31
- Joined: Wed Feb 08, 2017 5:42 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
I downloaded the last version and this question is not updated.
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
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.
Sorry about that.
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 3
- Joined: Sat Oct 26, 2013 4:31 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1379 :
I can confirm that the question is updated and makes sense as it is now. Thanks for the valuable discussion.
Who is online
Users browsing this forum: Bing [Bot] and 52 guests