previous | start | next

## Defining a New Interface Type

- Name the methods to conform to standard library
- `public interface MoveableShape
  {
  void draw(Graphics2D g2);
  void translate(int dx, int dy);
  }`
- `CarShape` class implements `MoveableShape`
  `public class CarShape implements MoveableShape
  {
  public void translate(int dx, int dy)
  { x += dx; y += dy; }
  . . .
  }`

previous | start | next