previous | start | next

## Float/Double Classes

- `Rectangle2D` class has no instance variables
- Template Method Pattern at work:

      public boolean contains(double x, double y)

      {

         double x0 = getX();

         double y0 = getY();

         return x >= x0 && y >= y0 &&

            x < x0 + getWidth() &&

            y < y0 + getHeight();

      }

- No need to use inner class after construction
  `Rectangle2D rect
  = new Rectangle2D.Double(5, 10, 20, 30);`

previous | start | next