10.12.2012 Views

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CLASSES Formal Parameters 8.4.1<br />

of the parameter. <strong>The</strong> last formal parameter in a list is special; it may be a variable<br />

arity parameter, indicated by an elipsis following the type:<br />

FormalParameterList:<br />

LastFormalParameter<br />

FormalParameters , LastFormalParameter<br />

FormalParameters:<br />

FormalParameter<br />

FormalParameters , FormalParameter<br />

FormalParameter:<br />

VariableModifiers Type VariableDeclaratorId<br />

VariableModifiers:<br />

VariableModifier<br />

VariableModifiers VariableModifier<br />

VariableModifier: one of<br />

final Annotation<br />

LastFormalParameter:<br />

VariableModifiers Type...opt VariableDeclaratorId<br />

FormalParameter<br />

<strong>The</strong> following is repeated from §8.3 to make the presentation here clearer:<br />

VariableDeclaratorId:<br />

Identifier<br />

VariableDeclaratorId [ ]<br />

If a method or constructor has no parameters, only an empty pair of parentheses<br />

appears in the declaration of the method or constructor.<br />

If two formal parameters of the same method or constructor are declared to<br />

have the same name (that is, their declarations mention the same Identifier), then a<br />

compile-time error occurs.<br />

If an annotation a on a formal parameter corresponds to an annotation type T,<br />

and T has a (meta-)annotation m that corresponds to annotation.Target, then m<br />

must have an element whose value is annotation.ElementType.PARAMETER, or<br />

a compile-time error occurs. Annotation modifiers are described further in §9.7.<br />

It is a compile-time error if a method or constructor parameter that is declared<br />

final is assigned to within the body of the method or constructor.<br />

When the method or constructor is invoked (§15.12), the values of the actual<br />

argument expressions initialize newly created parameter variables, each of the<br />

declared Type, before execution of the body of the method or constructor. <strong>The</strong><br />

DRAFT<br />

211

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!