public class ShapesDemo { public static void main(String[] args) { Shape[] shape= new Shape[3]; shape[0]=new Circle(1.0); shape[1]=new Rectangle(1.0, 2.0); shape[2]=new Square(1.0); double area; for(int i=0; i<3; i++) { area = shape[i].getArea(); System.out.println("Area = " + area); } } }