previous | start | next

## The `Class` Class

- `getClass` method gets class of any object
- Returns object of type `Class`
- `Class` object describes a type

      Object e = new Rectangle();

      Class c = e.getClass();

      System.out.println(c.getName()); // prints java.awt.Rectangle

- `Class.forName` method yields `Class` object:
  `Class c = Class.forName(java.awt.Rectangle);`
- `.class` suffix yields `Class` object:
  `Class c = Rectangle.class; // java.awt prefix not needed`
- `Class` is a misnomer: `int.class`, `void.class`,`Shape.class`

previous | start | next