Java Reference
In-Depth Information
The last formal parameter of a method or constructor is special: it may be a
variable arity
parameter
, indicated by an ellipsis following the type.
If the last formal parameter is a variable arity parameter, the method is a
variable arity
method
. Otherwise, it is a
fixed arity method
.
If a method or constructor has no formal parameters, only an empty pair of parentheses ap-
pears in the declaration of the method or constructor.
FormalParameterList:
LastFormalParameter
FormalParameters
,
LastFormalParameter
FormalParameters:
FormalParameter
FormalParameters
,
FormalParameter
FormalParameter:
VariableModifiers
opt
Type VariableDeclaratorId
VariableModifiers:
VariableModifier
VariableModifiers VariableModifier
VariableModifier: one of
Annotation
final
LastFormalParameter:
VariableModifiers
opt
Type
...
VariableDeclaratorId
FormalParameter
The following is repeated from §
8.3
to make the presentation here clearer:
VariableDeclaratorId:
Identifier
VariableDeclaratorId
[ ]
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.PARAMETER
, or a compile-
time error occurs.
It is a compile-time error for a method or constructor to declare two formal parameters with
the same name. (That is, their declarations mention the same
Identifier
.)