The Java® Language Specification, Java SE 7 Edition, Fourth Edition
by James Gosling, Bill Joy, Guy Steele, Gilad Bracha, Alex Buckley
8.9. Enums
An enum declaration specifies a new enum type.
EnumDeclaration: ClassModifiersopt enum Identifier Interfacesopt EnumBodyEnumBody: { EnumConstantsopt ,opt EnumBodyDeclarationsopt }
Enum types (§8.9) must not be declared abstract; doing so will result in a compile-time error.
An enum type is implicitly final unless it contains at least one enum constant that has a class body.
It is a compile-time error to explicitly declare an enum type to be final.
Nested enum types are implicitly static. It is permissible to explicitly declare a nested enum type to be static.
This implies that it is impossible to define a local (§14.3) enum, or to define an enum in an inner class (§8.1.3).
The direct superclass of an enum type named E is
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access