public class EnumDemo {
enum Numbers {
ONE(1), TWO(2), TEN(10);
int i;
Numbers(int i) {
this.i = i;
}
int getNumber() {
return i;
}
}
public static void main(String[] args) {
System.out.println(Numbers.ONE.getNumber());
System.out.println(Numbers.TWO.getNumber());
System.out.println(Numbers.TEN.getNumber());
}
}
Output:
1
2
10