About Question com.enthuware.jfcja.v8.2.283 :

Java Programmer Certification Questions and Discussion
1Z0-811
Post Reply
kdemello1980
Posts: 1
Joined: Sun Jun 07, 2020 3:28 pm
Contact:

About Question com.enthuware.jfcja.v8.2.283 :

Post by kdemello1980 »

This question requires us to pick 3 options where the code compiles correctly, however, per the explanation, only 2 of the options are valid. What are we supposed to do when the instructions don't match the number of valid answers?

for( int i = 0; i< 0; i++) x = 3; is said to be a correct option, however later it says

"for( int i = 0; false; i++) x = 3; is also a compile time error because x= 3 is unreachable."

It seems like it is impossible to correctly answer this question.

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

Re: About Question com.enthuware.jfcja.v8.2.283 :

Post by admin »

Both, the correct options as well as the explanation, are correct.

Option 4 i.e. for( int i = 0; i< 0; i++) x = 3; is correct because it will compile without any error.

The explanation talks about unreachable code and then shows a variation of option 4, which fails compilation because of this issue. for( int i = 0; false; i++) x = 3; is not same as the statement in option 4.

We will enhance the explanation to make this clear.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest