enum int java code example
Example 1: enum java
public enum AlertLevel {
Undefined(0),
Ok(1),
Warning(2),
Alarm(3);
}
Example 2: enum with numbers java
public enum EXIT_CODE {
A(104), B(203);
private int numVal;
EXIT_CODE(int numVal) {
this.numVal = numVal;
}
public int getNumVal() {
return numVal;
}
}