enumerations in java code example
Example 1: Enums injava
public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}
Example 2: what is enumeration in java
public class DaysOfTheWeek {
public enum Days {m, t, w, r, f, sat, s};
public static void main(String[] args) {
Days d = Days.t;
System.out.println(d);
//the output would be t
}
}