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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.