Given the following enum:
public enum Letter {
Alpha, Beta, Gamma, Delta;
}
Then both of the following compile without error:
Letter letter1 = Letter.Alpha;
Enum<Letter> letter2 = Letter.Beta;
Calling getClass() or name() or ordinal() on both letter1 and letter2 shows the same results.
But! The following will compile:
switch( letter1 ) {
case Alpha:
case Beta:
}
While this will not:
switch( letter2 ) {
case Alpha:
case Beta:
}
So what, if any, is the exact technical difference between these two variables?