I have some code to draw shapes, and I want to check that the number of shapes drawn are not over the amount of room in the array.

Code:
// In the constructor:
// shapeObjects = new Shape[ 10 ]; // Example length of array contains ten shapes
// numOfShapes = 0;

public void paintComponent( Graphics g ) {
    
    // Inherit the paintComponent method from the superclass
    super.paintComponent(
...