I am wondering why in the Java language a class
cannot extend an enum
.
I\'m not talking about an enum
extending an enum<
The whole point of an enum is to create a closed set of possible values. This makes it easier to reason about what a value of that enum type is -- easier for you the programmer, and also easier for the compiler (this closedness is what lets it handle enums efficiently in switches, for instance). Allowing a class to extend an enum would open up the set of possible values; at that point, what does the enum
buy you that a regular class
wouldn't?