01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
package factory.shape4;
import java.awt.Graphics;
public interface Shape {
  void paint(Graphics g);
}
class Ellipse implements Shape {
  Ellipse(int radius1, int radius2) { /* ... */ }
  public void paint(Graphics g) { /* ... */ }
  // ...
}
class Rectangle implements Shape {
  Rectangle(int height, int width) { /* ... */ }
  public void paint(Graphics g) { /* ... */ }
  // ...
}