Notes
The members of the Immutable interface have no explicit
modifiers.
The following paragraphs, taken verbatim from "The Java Language
Specification"
justify this choice.
- All interface members are implicitly public
§9.1.5.
- Every method declaration in the body of an interface is
implicitly abstract,
so its body is always represented by a semicolon, not a block. For
compatibility
with older versions of Java, it is permitted but discouraged, as a
matter
of style, to redundantly specify the abstract modifier
for methods declared in interfaces §9.4.
- Every method declaration in the body of an interface is
implicitly public.
It is permitted, but strongly discouraged as a matter of style, to
redundantly
specify the public modifier for interface methods
§9.4.
See also §8.3.1.2 (Fields in
classes).
A field can be declared final
(§4.5.4).
Both class and instance variables (static and non-static fields) may be
declared final .
See also §4.5.4 (final
Variables).
- A blank final is a
final variable whose declaration lacks an initializer.
- A blank final
instance variable must be definitely assigned
(§16.8) at the end of every constructor (§8.8) of the
class in which it is declared; otherwise a compile-time error
occurs.
- It is a compile-time error if a blank
final (§4.5.4) class
variable is not definitely assigned (§16.7) by a static
initializer (§8.7) of the class in which it is declared.