In ______________ we clone the object and their constituent parts.

Options
- Shallow cloning
- Deep cloning


CORRECT ANSWER : Deep cloning

Discussion Board
Deep copy

Clone is a process of replicating one object or collection of objects to produce the exact result or copy of the original object. Java objects are referred by reference and it is difficult to copy one object directly to another object. This process is required when we need a local copy of the original object to modify the object in some method but not in method caller. Deep copy is used when we need to copy an object in a way that it remains the exact copy at the same time it allows certain modification to be done according to the need. Deep copy can only be achieved if all the member class implements the Cloneable interface and override the clone() method of the object class.

Rohit Sharma 08-16-2014 09:20 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement