001package factory.shape2; 002import java.awt.Graphics; 003public interface Shape { 004 void paint(Graphics g); 005} 006class Circle implements Shape { 007 public void paint(Graphics g) { /* ... */ } 008 // ... 009} 010class Square implements Shape { 011 public void paint(Graphics g) { /* ... */ } 012 // ... 013}