Cloning
From Suhrid.net Wiki
Jump to navigationJump to search
- There is no syntactical way to copy an object in Java. The assignment operator just's duplicates the reference.
- Cloning and the clone() method provides a way to perform such copying.
- The object class has a clone() method which is protected. So it has to be overriden in the implementing class in order to use it.
- The default implementation can call super.clone() - but this means the class has to implement the Cloneable marker interface.