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 (§14.11).
The scope of a formal parameter of a method (§8.4.1), constructor (§8.8.1), or
lambda expression (§15.27) is the entire body of the method, constructor, or lambda
expression.
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 declaration, and the class body.
The scope of an interface's type parameter (§9.1.2) is the type parameter section
of the interface declaration, the type parameter section of any superinterface of the
interface declaration, 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 constructor, 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.
The scope of a local class declaration immediately enclosed by a switch block
statement group (§14.11) is the rest of the immediately enclosing switch block
statement group, including its own class declaration.
The scope of a local variable declaration in a block (§14.4) is the rest of the block
in which the declaration appears, starting with its own initializer and including any
further declarators to the right in the local variable declaration statement.
The scope of a local variable declared in the ForInit part of a basic for statement
(§14.14.1) includes all of the following:
• Its own initializer
• Any further declarators to the right in the ForInit part of the for statement
• The Expression and ForUpdate parts of the for statement
• The contained Statement
The scope of a local variable declared in the FormalParameter part of an enhanced
for statement (§14.14.2) is the contained Statement.