INTERFACES
Examples of Abstract Method Declarations
9.4.3
class BufferEmpty extends Exception {
BufferEmpty() { super(); }
BufferEmpty(String s) { super(s); }
}
class BufferError extends Exception {
BufferError() { super(); }
BufferError(String s) { super(s); }
}
public interface Buffer {
char get() throws BufferEmpty, BufferError;
}
public interface InfiniteBuffer extends Buffer {
char get() throws BufferError;
//
override
}
9.4.3.2
Example: Overloading
In the example code:
interface PointInterface {
void move(int dx, int dy);
}
interface RealPointInterface extends PointInterface {
void move(float dx, float dy);
void move(double dx, double dy);
}
the method name
move
is overloaded in interface
RealPointInterface
with
three different signatures, two of them declared and one inherited. Any class that
implements interface
RealPointInterface
must provide implementations of all
three method signatures.
Death, life, and sleep, reality and thought,
Assist me, God, their boundaries to know . . .
William Wordsworth,
Maternal Grief
191
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved