public class GeometricObjectsTest { public static void main(String[] args) { GeometricObject[] objects = new GeometricObject[5]; objects[0] = new Triangle(1.0, 2.0, 3.0); objects[1] = new Triangle(3.0, 4.0, 5.0); objects[2] = new Circle(3.0);//the parameter is the radius of the circle objects[3] = new Rectangle(3.0, 5.0); objects[4] = new Rectangle(3.4, 5.0); for (int i = 0; i < objects.length; i++) { System.out.println("object nr. " + i + " is a " + objects[i].getType() + " and has an area of " + objects[i].computeArea()); } } }