Enums With Default Throw Clause?
- by Tom Tresansky
I noticed the following in the Java Language spec in the section on enumerations here: link
switch(this) {
case PLUS: return x + y;
case MINUS: return x - y;
case TIMES: return x * y;
case DIVIDE: return x / y;
}
throw new AssertionError("Unknown op: " + this);
However, looking at the switch statement definition section, I didn't…