Java Reference
In-Depth Information
throws
clause
t
declared in
Object
, unless a method with the same signature, same re-
turn type, and a compatible
throws
clause is explicitly declared by the interface.
It is a compile-time error if the interface explicitly declares such a method
m
in the
case where
m
is declared to be
final
in
Object
.
It follows that is a compile-time error if the interface declares a method with a sig-
ferent return type or incompatible
throws
clause.
The interface inherits, from the interfaces it extends, all members of those interfaces, ex-
cept for (a) fields, classes, and interfaces that it hides and (b) methods that it overrides
Fields, methods, and member types of an interface type may have the same name, since
they are used in different contexts and are disambiguated by different lookup procedures
9.3. Field (Constant) Declarations
ConstantDeclaration:
ConstantModifiers
opt
Type VariableDeclarators
;
ConstantModifiers:
ConstantModifier
ConstantModifier ConstantModifers
ConstantModifier: one of
Annotation
public static final
and
T
has a (meta-)annotation
m
that corresponds to
java.lang.annotation.Target
, then
m
must
have an element whose value is
java.lang.annotation.ElementType.FIELD
, or a compile-time er-
ror occurs.
Every field declaration in the body of an interface is implicitly
public
,
static
, and
final
. It is
permitted to redundantly specify any or all of these modifiers for such fields.
If two or more (distinct) field modifiers appear in a field declaration, it is customary,
though not required, that they appear in the order consistent with that shown above in
the production for
ConstantModifier
.
It is a compile-time error if the same modifier appears more than once in a field declaration.