Modifiers of Fields
In the abstract, the declaration format is:
fieldModifiers type variableDeclaratorList ;
where a variableDeclarator has the format:
fieldName [ dimensionStuff ] [ = expression ]
Possible fieldModifiers are:
- public—this field is accessible from any code.
- protected—accessible from code in a subclass (or the same package—default accessibility).
- private—only accessible from code in the same class.
- static—this is a class variable: see earlier.
- final—this field cannot be modified after it is initialized.
- transient—the value of this field will not be included in a serialized representation of an instance.
- volatile—any cached copy of the field maintained by an individual thread will be reconciled with the master copy every time the field is accessed.