Abstract Methods and Classes
The draw() method in the Shape class does nothing. It may not be necessary to give a implementation of this method in the base class at all, because it may be that it is only ever invoked on instances of subclasses representing concrete shapes (as here).
In this situation, the superclass and unimplemented methods can be declared abstract:
abstract class Shape { // abstract class
abstract void draw() ; // abstract method
Color color ;
int x, y ;
}
It is not possible to create instances of abstract classes. One must create a subclass that overrides all abstract methods of the base class, giving implementations.