Java Reference
In-Depth Information
VariableDeclarators:
VariableDeclarator
VariableDeclarators , VariableDeclarator
VariableDeclarator:
VariableDeclaratorId
VariableDeclaratorId = VariableInitializer
VariableDeclaratorId:
Identifier
VariableDeclaratorId []
VariableInitializer:
Expression
ArrayInitializer
Every local variable declaration statement is immediately contained by a block. Local vari-
able declaration statements may be intermixed freely with other kinds of statements in the
block.
A local variable declaration can also appear in the header of a for statement (§ 14.14 ) . In
this case it is executed in the same manner as if it were part of a local variable declaration
statement.
14.4.1. Local Variable Declarators and Types
Each declarator in a local variable declaration declares one local variable, whose name is
the Identifier that appears in the declarator.
If the optional keyword final appears at the start of the declarator, the variable being de-
clared is a final variable (§ 4.12.4 ) .
If an annotation a 9.7 ) on a local variable declaration corresponds to an annotation type
T , 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.LOCAL_VARIABLE , or a
compile-time error occurs.
The declared type of a local variable is denoted by the Type that appears in the local vari-
able declaration, followed by any bracket pairs that follow the Identifier in the declarator.
A local variable of type float always contains a value that is an element of the float value set
4.2.3 ) ; similarly, a local variable of type double always contains a value that is an element
of the double value set. It is not permitted for a local variable of type float to contain an ele-
ment of the float-extended-exponent value set that is not also an element of the float value
Search WWH ::




Custom Search