Much clearer, safer, more powerful than existing alternatives
Enum printed values are informative
Works fine with new for each and Generics
Notes:
Only one copy of each value (instance) of an
Enum class is allowed.
Natural enumerated types
─ Days of week, phases of moon, seasons, compass
points, colors in spectrum
• Other sets where you know all possible values
─ Choices on Menu, Rounding modes, command line
flags, opcodes in instruction set
─ Can add more in new version of API
• As a replacement for flags (EnumSet)
The operator == works fine.
No new instances allowed.
No public constructors allowed.
No subclasses allowed (messy semantics).
Each instance must be created.
Static initializers cannot refer to the instances.