What will be the result of attempting to compile and run the following code?
public class Main{ public static void main (String args []){ for ( int i = 0 ; i < 3 ; i++){ boolean flag = false; switch (i){ flag = true; /*from w ww.jav a 2s .c o m*/ } if ( flag ) System .out.println ( i ); } } }
Select 1 option
Correct Option is : C
You cannot have unlabeled block of code inside a switch block.