Java Reference
In-Depth Information
tialized first (§
12.4.2
). This also applies to
static final
fields in classes (§
8.3.2.1
). These fields
9.4. Abstract Method Declarations
AbstractMethodDeclaration:
AbstractMethodModifiers
opt
TypeParameters
opt
Result
MethodDeclarator Throws
opt
;
AbstractMethodModifiers:
AbstractMethodModifier
AbstractMethodModifiers AbstractMethodModifier
AbstractMethodModifier: one of
Annotation
public abstract
must have an element whose value is
java.lang.annotation.ElementType.METHOD
, or a compile-
time error occurs.
Every method declaration in the body of an interface is implicitly
abstract
, so its body is al-
ways represented by a semicolon, not a block.
It is permitted, but discouraged as a matter of style, to redundantly specify the
public
and/or
abstract
modifier for a method declared in an interface.
It is a compile-time error if the same modifier appears more than once on a method declared
in an interface.
It is a compile-time error if a method declared in an interface is declared
static
, because
static
methods cannot be
abstract
.
It is a compile-time error if a method declared in an interface is
strictfp
or
native
or
synchron-
ized
, because those keywords describe implementation properties rather than interface prop-
erties.
However, a method declared in an interface may be implemented by a method that is de-
clared
strictfp
or
native
or
synchronized
in a class that implements the interface.