O'Reilly logo

The Java® Language Specification, Java SE 7 Edition, Fourth Edition by Alex Buckley, Gilad Bracha, Guy Steele, Bill Joy, James Gosling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required