Names of fields that are not final
should be in mixed case with a lowercase first
letter and the first letters of subsequent words capitalized. Note that well-designed
Java classes have very few public
or protected
fields, except for fields that are
constants (final
static
fields) (§6.8.5).
Fields should have names that are nouns, noun phrases, or abbreviations for nouns. Examples of this convention are the fields buf
, pos
, and count
of the class java.io.ByteArrayInputStream
(§22.6) and the field bytesTransferred
of the class java.io.InterruptedIOException
(§22.30.1).
Hiding involving field names is rare.
import
declaration (§7.5) can usually be used to make available the type names declared in that package.