clone method creates a copy of the object, but a different object is created. How can I make the cloned object point to the same object from which it was cloned?
Printable View
clone method creates a copy of the object, but a different object is created. How can I make the cloned object point to the same object from which it was cloned?
Hello javaplus
Override the clone() method of your class:
This is a bit pointless, but it should do the trick. ;)Code:public Object clone(){
return this;
}
:)
Great trick.
Works fine.