public enum MyEnum {
ONE(1),
TWO(2);
private int value;
private MyEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
In short – you can define any number of parameters for the enum as long as you provide constructor arguments (and set the values to the respective fields)
As Scott noted – the official enum documentation gives you the answer. Always start from the official documentation of language features and constructs.
Update: For strings the only difference is that your constructor argument is String, and you declare enums with TEST("test")