What is the result of the following code? (Choose all that apply.)
public class IceCream { enum Letter { A, B, C //from w w w. j ava 2s. co m } public static void main(String[] args) { Letter f = Letter.C; switch (f) { case 0: System.out.println("vanilla"); case 1: System.out.println("chocolate"); case 2: System.out.println("strawberry"); break; default: System.out.println("missing flavor"); } } }
E.
A case statement on an enum data type must be the unqualified name of an enumeration constant.
For example, case A would be valid.
You cannot use the ordinal equivalents.
Therefore, the code does not compile.