8.3. Field Declarations

The variables of a class type are introduced by field declarations.

FieldDeclaration:    FieldModifiersopt Type VariableDeclarators ;VariableDeclarators:    VariableDeclarator    VariableDeclarators , VariableDeclaratorVariableDeclarator:    VariableDeclaratorId    VariableDeclaratorId = VariableInitializerVariableDeclaratorId:    Identifier    VariableDeclaratorId [ ]VariableInitializer:    Expression    ArrayInitializer

The FieldModifiers are described in §8.3.1.

The Identifier in a FieldDeclarator may be used in a name to refer to the field.

More than one field may be declared in a single field declaration by using more than one declarator; the FieldModifiers and Type apply to all the declarators in the declaration. ...

Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.