Java Reference
In-Depth Information
}
interface InfiniteBuffer extends Buffer {
char get() throws BufferException; // override
}
9.4.1.2. Requirements in Overriding
The relationship between the return type of an interface method and the return types of any
The relationship between the
throws
clause of an interface method and the
throws
clauses of
The relationship between the signature of an interface method and the signatures of over-
ridden interface methods are specified in §
8.4.8.3
.
9.4.1.3. Inheriting Methods with Override-Equivalent Signatures
It is possible for an interface to inherit several methods with override-equivalent signatures
sidered to inherit all the methods.
However, one of the inherited methods must be return-type-substitutable for every other
inherited method; otherwise, a compile-time error occurs. (The
throws
clauses do not cause
errors in this case.)
There might be several paths by which the same method declaration is inherited from an
interface. This fact causes no difficulty and never, of itself, results in a compile-time error.
9.4.2. Overloading
If two methods of an interface (whether both declared in the same interface, or both in-
herited by an interface, or one declared and one inherited) have the same name but differ-
overloaded
.
This fact causes no difficulty and never of itself results in a compile-time error. There is no
required relationship between the return types or between the
throws
clauses of two methods
with the same name but different signatures that are not override-equivalent.
Example 9.4.2-1. Overloading an
abstract
Method Declaration
interface PointInterface {