Tag Archives: Deep vs. Shallow copying

Shallow Copy vs Deep Copy

Shallow Copy By default when we call clone() method, it create shallow(little deep) copy of the object. It create the copy of the primitive fields but copy only the reference of non primitive fields. Above example is the example of Shallow copy. In this example it creates only one Department object and when we call Continue Reading…