How we can make copy of a java object?
For copying an object in Java, there are two ways- shallow copy and deep copy.
Shallow Copy | Deep Copy | |
---|---|---|
1. | When you want to copy only field values | All the objects are deeply copied |
2. | Copy is dependant on original object | Copy is not dependent on earlier objects |
BY Best Interview Question ON 13 Jan 2019