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.
The scope and shadowing of a class declaration is specified in § 6.3 and § 6.4 .
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
If an annotation a 9.7 ) on a class declaration corresponds to an annotation type T 9.6 ) ,
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.
The access modifier public 6.6 ) pertains only to top level classes (§ 7.6 ) and to member
classes (§ 8.5 ) , not to local classes (§ 14.3 ) or anonymous classes (§ 15.9.5 ) .
The access modifiers protected and private 6.6 ) pertain only to member classes within a dir-
ectly enclosing class or enum declaration (§ 8.5 ).
The modifier static pertains only to member classes (§ 8.5.1 ) , not to top level or local or an-
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.
Search WWH ::




Custom Search