About Question enthuware.ocpjp.i.v11.2.3225 :

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

Moderator: admin

Post Reply
silver2050
Posts: 2
Joined: Sun Apr 19, 2020 3:56 am
Contact:

About Question enthuware.ocpjp.i.v11.2.3225 :

Post by silver2050 »

Hi,

class SwitchTest{
public static void main(String args[]){
for ( var i = 0 ; i < 3 ; i++){ //1
boolean flag = false;
switch (i){ //2
flag = true; //3
}
if ( flag ) System.out.println( i );
}
}
}


Compilation error at line marked //3.

Please could you explain this error to me? According to eclipse, the error occurs on line 2.

Thank you very much in advance

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

Re: About Question enthuware.ocpjp.i.v11.2.3225 :

Post by admin »

Please compile the code from the command line using Oracle's JDK's javac.

We do not recommend IDEs while studying for certification because, among other reasons, messages generated by IDEs may be different.

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests