Introduction to Polymorphism


public void paint(Graphics g) {

for (int i = 0; i < arrayOfShapes.length; i++)

arrayOfShapes[i].draw(g);

}