I studied Java is pass object reference by value, and in order to make a local copy of an object, I can either do clone() or copy-constructor. I also looked at deep/shallow
Use the copy constructor whenever you can. clone() is obsolete and should not be used (neither implemented) in new code.
If you extend a class that implements
Cloneable, you have little choice but to implement a well-behavedclonemethod. Otherwise, you are better off providing an alternative means of object copying, or simply not providing the capability. [...] A fine approach to object copying is to provide a copy constructor or copy factory. [...]Given all of the problems associated with
Cloneable, it’s safe to say that other interfaces should not extend it, and that classes designed for inheritance (Item 17) should not implement it. Because of its many shortcomings, some expert programmers simply choose never to override theclonemethod and never to invoke it except, perhaps, to copy arrays.
From Effective Java 2nd Edition, Item 11.