I understand I can create an enum like this:
public enum MyEnum {
ONE(1),
TWO(2);
private int value;
private MyEnum(int value) {
this.value = value);
}
public int getValue() {
return value;
}
}
But I have some questions:
1) It seems that the enum values are declared at the start. Is there a particular format for this. Could I declare them anywhere?
2) Is is possible to declare an enum with more than one constructor and is this something that people sometimes do?
1 Answer