Site hosted by Angelfire.com: Build your free website today!
 

Abstract Classes

An abstract class may contain abstract methods, that is, methods with no implementation. An abstract class leaves some of the implementation to its subclasses.

abstract class GraphicObject {
    int x, y;
    . . .
    void moveTo(int newX, int newY) {
        . . .
    }
    abstract void draw();
}
class Circle extends GraphicObject {
    void draw() {
        . . .
    }
}
class Rectangle extends GraphicObject {
    void draw() {
        . . .
    }
}

An abstract class cannot be instantiated.