I understand that I can create an enumeration as follows:
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 a few questions:
1) It seems that the enumeration values ββare declared at the beginning. Is there a specific format for this. Can I declare them anywhere?
2) Is it possible to declare an enumeration with more than one constructor, and this is what people sometimes do?
Alan2 source
share