Java Reference
In-Depth Information
6.2.1. Enum Modifiers
An enum declaration can be preceded by certain modifiers:
•
annotations
Annotations and annotation types are discussed in
•
access modifiers
Nested enum declarations can have any of the
access modifiers, while a top-level enum, as for a top-level class,
is either
public
or in the absence of an access modifier, accessible
only within its own package.
•
static
All nested enums are implicitly
static
because they contain
static members. By convention, the
static
modifier is always
omitted.
•
strict floating point
All floating-point arithmetic within an enum
page
203
for details.
When multiple modifiers are applied to the same interface declaration,
we recommend using the order listed above.
An enum cannot be declared
abstract
because you cannot extend it to
provide missing method implementationshowever, an enum can declare
abstract
methods. You'll shortly see how this apparent contradiction is
resolved.
An enum also cannot be explicitly declared
final
, though it acts as if it
were final. You'll shortly see why this is so, too.