Monday, May 17, 2010

Controlling Cloneability

If you want a class to be cloneable:

1. Implement the Cloneable interface.
2. Override clone( ).
3. Call super.clone( ) inside your clone( ).
4. Capture exceptions inside your clone( ).

This will produce the most convenient effects.


Courtesy: http://www.codeguru.com/java/tij/tij0128.shtml

No comments:

Post a Comment