1An abstract class is a class that is declared abstract —it may or may not
2include abstract methods. Abstract classes cannot be instantiated,
3but they can be subclassed. When an abstract class is subclassed,
4the subclass usually provides implementations for all of the abstract methods
5in its parent class.
6
7abstract class GraphicObject {
8 int x, y;
9 ...
10 void moveTo(int newX, int newY) {
11 ...
12 }
13 abstract void draw();
14 abstract void resize();
15}
16
17// extending abstract class
18class Circle extends GraphicObject {
19 void draw() {
20 ...
21 }
22 void resize() {
23 ...
24 }
25}
26class Rectangle extends GraphicObject {
27 void draw() {
28 ...
29 }
30 void resize() {
31 ...
32 }
33}