Interview Questions

Object Cloning in Java

Java Interview Questions for Cloning and Cloneable


(Continued from previous question...)

Object Cloning in Java

Objects in Java are referred using reference types, and there is no direct way to copy the contents of an object into a new object.

The assignment of one reference to another merely creates another reference to the same object. Therefore, a special clone() method exists for all reference types in order to provide a standard mechanism for an object to make a copy of itself. Here are the details you need to know about cloning Java objects.

(Continued on next question...)

Other Interview Questions