previous | start | next

## Enumerating Constructors

- Print the names and parameter types of all `Rectangle`
  constructors:

      for (int i = 0; i < cons.length; i++)

      {

         Class[] params = cons[i].getParameterTypes();

         System.out.print("Rectangle(");

         for (int j = 0; j < params.length; j++)

         {

            if (j > 0) System.out.print(", ");

            System.out.print(params[j].getName());

         }

         System.out.println(")");

      }

- Yields

      Rectangle()

      Rectangle(java.awt.Rectangle)

      Rectangle(int, int, int, int)

      Rectangle(int, int)

      Rectangle(java.awt.Point, java.awt.Dimension)

      Rectangle(java.awt.Point)

      Rectangle(java.awt.Dimension)

previous | start | next