Java Reference
In-Depth Information
The package java is always in scope.
The scope of a type imported by a single-type-import declaration (§ 7.5.1 ) or a type-import-
on-demand declaration (§ 7.5.2 ) is all the class and interface type declarations (§ 7.6 ) in the
compilation unit in which the import declaration appears, as well as any annotations on the
package declaration (if any) of the compilation unit.
The scope of a member imported by a single-static-import declaration (§ 7.5.3 ) or a static-
import-on-demand declaration (§ 7.5.4 ) is all the class and interface type declarations (§ 7.6 )
in the compilation unit in which the import declaration appears, as well as any annotations
on the package declaration (if any) of the compilation unit.
The scope of a top level type (§ 7.6 ) is all type declarations in the package in which the top
level type is declared.
The scope of a declaration of a member m declared in or inherited by a class type C 8.1.6 )
is the entire body of C , including any nested type declarations.
The scope of a declaration of a member m declared in or inherited by an interface type I
9.1.4 ) is the entire body of I , including any nested type declarations.
The scope of an enum constant C declared in an enum type T is the body of T , and any case
label of a switch statement whose expression is of enum type T .
The scope of a formal parameter of a method (§ 8.4.1 ) or constructor (§ 8.8.1 ) is the entire
body of the method or constructor.
The scope of a class's type parameter (§ 8.1.2 ) is the type parameter section of the class
declaration, the type parameter section of any superclass or superinterface of the class de-
claration, and the class body.
The scope of an interface's type parameter (§ 9.1.2 ) is the type parameter section of the in-
terface declaration, the type parameter section of any superinterface of the interface declar-
ation, and the interface body.
The scope of a method's type parameter (§ 8.4.4 ) is the entire declaration of the method,
including the type parameter section, but excluding the method modifiers.
The scope of a constructor's type parameter (§ 8.8.4 ) is the entire declaration of the con-
structor, including the type parameter section, but excluding the constructor modifiers.
The scope of a local class declaration immediately enclosed by a block (§ 14.2 ) is the rest
of the immediately enclosing block, including its own class declaration.
Search WWH ::




Custom Search