A shallow copy would copy the object without any of its contents or data, In copied object all the variables are passed by reference from the original object.
Remeber that, In shallow copy, Copied object and Original object refer to the same data in memory.
Hence modifying the state of the original object would also modify the state of the copied object too.
By default, when you call the super.clone() method against an object, It would perform a shallow copy.
The second type of copy, Deep-copy copies the object including all the contents / states.
Hence each object refers to a different space in memory and modifying one object will not affect the other.
Remember that to make an exact copy of an object (deep copy), you must serialize the object.
Remeber that, In shallow copy, Copied object and Original object refer to the same data in memory.
Hence modifying the state of the original object would also modify the state of the copied object too.
By default, when you call the super.clone() method against an object, It would perform a shallow copy.
The second type of copy, Deep-copy copies the object including all the contents / states.
Hence each object refers to a different space in memory and modifying one object will not affect the other.
Remember that to make an exact copy of an object (deep copy), you must serialize the object.