posted 16 years ago
The method clone is available in every class because it is a public method in Object class.
Just implement Cloneable interface and you can use the method but if you call clone method without implementing the above mentioned interface, CloneNotSupported Exception is thrown.
Other thing to note about is deep cloning where in each object is carbon copied so that each reference of the clone refers to a new object instead of the objects referred by corresponding reference variables in the original copy.
SCJP 96% | SCWCD 90%| SCJP mock exams | My SCJP blog