Java Reference
In-Depth Information
The rules in this section apply to all class declarations unless this specification explicitly
states otherwise. In many cases, special restrictions apply to enum declarations (§
8.9
).
The
Identifier
in a class declaration specifies the name of the class.
It is a compile-time error if a class has the same simple name as any of its enclosing classes
or interfaces.
8.1.1. Class Modifiers
A class declaration may include
class modifiers
.
ClassModifiers:
ClassModifier
ClassModifiers ClassModifier
ClassModifier: one of
Annotation
public protected private
abstract static final strictfp
and
T
has a (meta-)annotation
m
that corresponds to
java.lang.annotation.Target
, then
m
must
have an element whose value is
java.lang.annotation.ElementType.TYPE
, or a compile-time error
occurs.
ectly enclosing class or enum declaration (§
8.5
).
onymous classes.
It is a compile-time error if the same modifier appears more than once in a class declaration.
If two or more (distinct) class modifiers appear in a class declaration, then it is cus-
tomary, though not required, that they appear in the order consistent with that shown
above in the production for
ClassModifier
.
8.1.1.1. abstract Classes
An
abstract
class is a class that is incomplete, or to be considered incomplete.