The following example shows how to use enum in switch case.
All enum types implicitly implements java.io.Serializable and java.lang.Comparable.
Note that in switch case we have given unqualified enum constant name without enum type prefix.
Enum provides the following APIs,
public static <E extends Enum<E>> E[] values();
- Returns all enum constants of this element type.