DEVFYI - Developer Resource - FYI

What is the difference between shallow copy and deep copy?

Java Interview Questions and Answers (part 1)


(Continued from previous question...)

138. What is the difference between shallow copy and deep copy?

Shallow copy shares the same reference with the original object like cloning, whereas the deep copy get a duplicate instance of the original object. If the shallow copy has been changed, the original object will be reflected and vice versa.

(Continued on next question...)

Other Interview Questions