Wednesday, 18 November 2015

What is the difference between Shallow cloning and Deep cloning

S.No
Shallow Cloning
Deep Cloning
1
Here copied object points to the same location the previous object points to. So if u want to change anything for main object it will reflect for copied object also.
Here copied object points to the other location and points to other reference. So if u want to change anything it wont reflect for main object.
2
By default java supports shallow cloning
By default java does not support deep cloning.


No comments:

Post a Comment