Things in the Java language which hold data, or hold
pointers to objects are called fields. Think of
fields as variables. Fields are containers for
things of a specific
type. Only things that are qualified to be
of this specific type are allowed to go into
the container.
There are four parts to a field declaration:
modifiers type fieldSpecifications ;
where:
- modifiers are keywords like
public, private, final,
and static.
- type is a keyword for a Java
primitive type, a primitive type suffixed
with "[]" or a class identifier.
- fieldSpecifications is a list of comma separated
field identifiers with optional initializers
that looks like an
assignment
statements with the new field identifier as
the LeftHandSide.
- punctuation - a semicolon to terminate the
declaration.