What is clone is used for? What is the difference between shallow & deep clone? Can anybody give some examples on clone?Is there any questions will be asked in clone for JDK1.4?
Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
Cloning is for the sheep. Cloning a sheep called Dolly makes another identical sheep called Dolly2. However, suppose that Dolly has a baby lamb. If we shallow clone Dolly, then Dolly2 will think that the lamb is hers too, and Dolly will not like that at all.
But if we deep clone Dolly, then we have to clone the lamb too. Then for Dolly2 all is fine because she has her own baby lamb to care for.