how to use java enum code example
Example 1: enum java
public enum AlertLevel {
Undefined(0),
Ok(1),
Warning(2),
Alarm(3);
}
Example 2: java enum
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
}
}