Java Reference
In-Depth Information
It is a compile-time error if a method declaration that contains the keyword
native
also con-
tains
strictfp
.
If two or more (distinct) method modifiers appear in a method declaration, it is cus-
tomary, though not required, that they appear in the order consistent with that shown
above in the production for
MethodModifier
.
8.4.3.1. abstract Methods
An
abstract
method declaration introduces the method as a member, providing its signature
The declaration of an
abstract
method
m
must appear directly within an
abstract
class (call it
a compile-time error occurs.
It would be impossible for a subclass to implement a
private abstract
method, because
private
methods are not inherited by subclasses; therefore such a method could never
be used.
An
abstract
class can override an
abstract
method by providing another
abstract
method declar-
ation.
This can provide a place to put a documentation comment, to refine the return type, or
od, when it is implemented by its subclasses, is to be more limited.
An instance method that is not
abstract
can be overridden by an
abstract
method.
Example 8.4.3.1-1. Abstract/Abstract Method Overriding
class BufferEmpty extends Exception {
BufferEmpty() { super(); }
BufferEmpty(String s) { super(s); }
}
class BufferError extends Exception {
BufferError() { super(); }
BufferError(String s) { super(s); }
}
interface Buffer {
char get() throws BufferEmpty, BufferError;