// array of objects

class Rect {
    private int w;
    private int h;
    public Rect(int w, int h) {	this.w = w; this.h = h; }
    public int getArea() { return w*h; }
}

public class arrayOfObjects {
    public static void main(String[] args) {
	final int SIZE = 3;
	int i = 0;
        Rect[] r = new Rect[SIZE];
		
	// Make lots of Rects of various sizes:
	for(i=0 ; i < SIZE ; i++)
	    r[i] = new Rect(i+1,i+2);

	// Find and print the total area for all created Rects:
	int area = 0;
        for(i=0 ; i < SIZE ; i++)
            area += r[i].getArea();
        System.out.println("The total area is " + area+".");
	
    }
} 

// output: The total area is 20.