In a java interview, I was asked what is the different between copy and clone function. What I think both the method are used to make a copy of a object.
Another problem related with clone:
- How to make a deep copy of a list and hashmap?
- For above question, can we directly call list
Object#clone
method?
here copy refer to the function present in collections.