Intent
Cloning an object by reducing the cost of creation.
Where to use & benefits
- When there are many subclasses that differ only in the kind of objects,
- A system needs independent of how its objects are created, composed, and represented.
- Dynamic binding or loading a method.
- Use one instance to finish job just by changing its state or parameters.
- Add and remove objects at runtime.
- Specify new objects by changing its structure.
- Configure an application with classes dynamically.
Structure

Participants
Prototype (java.lang.Cloneable)
declares an interface for cloning itself
ConcretePrototype (RectangleShape, CircleShape, TriangleShape)
implements an operation for cloning itself
Client (MainApplet)
creates a new object by asking a prototype to clone itself
Example
In the demonstration application, the shape (Rectangle, Trinagle, Circle) objects implements the Cloneable interface to provide the facility to clone the object and the MainApplet class uses the facility to clone already created shape object.
Class Diagram
