PrepZone Logo
PrepZone
Back to Java

Java · Medium

Difference between deep copy and shallow copy.

JavaOOP

Answer preview

Shallow copy — Creates a new object but copies only the references to nested objects — the original and copy share the same internal objects. Modifying a nested object in one affects the other.…