To print the area of two rectangles having different dimensions, create two objects of the Rectangle class, each representing a rectangle. Before moving to the concept of array of objects, let's first see an example of printing the area of two rectangles. The syntax for declaring an array of objects is class_name array_name [size] ;