Why does the following code fail to compile, while changing the case statement to
case ENUM1: doSomeStuff();
works?
public
This is not really answering your question but if you have code depending on the enum value, you can also create an abstract method in your enum that gets overloaded for every value:
public enum EnumType {
ENUM1 {
@Override
public void doSomeStuff() {
// do something
}
},
ENUM2 {
@Override
public void doSomeStuff() {
// do something else
}
};
public abstract void doSomeStuff();
}