Shape:
Shape arrayOfShapes[] = new Shape[100];
To distinguish each subclass of Shape, you give Shape an int instance variable shapeType.
Each subclass inherits this instance variable and statically sets it to a value representing that subclass of Shape.
You invoke the proper draw method via a switch statement:
public void paint(Graphics g) {
for (int i = 0; i < arrayOfShapes.length; i++)
switch (arrayOfShapes[i].getShapeType() ) {
case TRIANGLE:
arrayOfShapes[i].drawTriangle(g);
break;case SQUARE:
arrayOfShapes[i].drawSquare(g);
break;. . .
case CIRCLE:
arrayOfShapes[i].drawCircle(g);
break;}
}