Page 1 of 1

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

Posted: Sun Apr 26, 2020 4:02 pm
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

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

Posted: Sun Apr 26, 2020 10:44 pm
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.