About Question enthuware.ocpjp.i.v11.2.3225 :
Posted: Sun Apr 26, 2020 4:02 pm
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
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