What is the result of executing the following code when the value of i is 5:
switch (i){//from ww w. j a v a 2s . c o m default: case 1: System.out.println (1); case 0: System.out.println (0); case 2: System.out.println (2); break; case 3: System.out.println (3); }
Select 1 option
Correct Option is : A
The type of the Expression must be char, byte, short, or int or a compile-time error occurs.
Java 7 allows String as well.
The class of the switch variable may also be a Wrapper class:Character, Byte, Short, or Integer.