The names of constants in interface types should be, and final
variables of class
types may conventionally be, a sequence of one or more words, acronyms, or
abbreviations, all uppercase, with components separated by underscore "_
" characters. Constant names should be descriptive and not unnecessarily abbreviated.
Conventionally they may be any appropriate part of speech. Examples of names
for constants include MIN_VALUE
, MAX_VALUE
, MIN_RADIX
, and MAX_RADIX
of the
class java.lang.Character
.
A group of constants that represent alternative values of a set, or, less frequently, masking bits in an integer value, are sometimes usefully specified with a common acronym as a name prefix, as in:
interface ProcessStates { int PS_RUNNING = 0; int PS_SUSPENDED = 1; }
Hiding involving constant names is rare: