Consider the following code snippet:
XXXX m ; switch ( m ){ case 32 : System.out.println ("32"); break; case 64 : System.out.println ("64"); break; case 128 : System.out.println ("128"); break; }
What type can 'm' be of so that the above code compiles and runs as expected ?
Select 3 options
Correct Options are : A C E
Only byte, char, short, int, and enum values can be used as types of a switch variable.
Java 7 allows String as well.
The switch variable must be big enough to hold all the case constants.
if switch variable is of type char, then none of the case constants can be greater than 65535 because char's range is from 0 to 65535.
All case labels should be Compile Time Constants.