Java Reference
In-Depth Information
void move(int dx, int dy);
}
interface RealPointInterface extends PointInterface {
void move(float dx, float dy);
void move(double dx, double dy);
}
Here, the method named
move
is overloaded in interface
RealPointInterface
with three
different signatures, two of them declared and one inherited. Any non-
abstract
class
that implements interface
RealPointInterface
must provide implementations of all three
method signatures.
9.5. Member Type Declarations
A member type declaration in an interface is implicitly
static
and
public
. It is permitted to
redundantly specify either or both of these modifiers.
It is a compile-time error if the same modifier appears more than once in a member type
declaration in an interface.
If an interface declares a member type with a certain name, then the declaration of that type
is said to
hide
any and all accessible declarations of member types with the same name in
superinterfaces of the interface.
An interface inherits from its direct superinterfaces all the non-
private
member types of the
superinterfaces that are both accessible to code in the interface and not hidden by a declar-
ation in the interface.
An interface may inherit two or more type declarations with the same name. It is a compile-
time error to attempt to refer to any ambiguously inherited class or interface by its simple
name.
If the same type declaration is inherited from an interface by multiple paths, the class or
interface is considered to be inherited only once; it may be referred to by its simple name
without ambiguity.
9.6. Annotation Types
An
annotation type declaration
is a special kind of interface declaration. To distinguish an
annotation type declaration from an ordinary interface declaration, the keyword
interface
is
preceded by an at-sign (
@
).