This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Clone concept doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Clone concept doubt" Watch "Clone concept doubt" New topic
Author

Clone concept doubt

akshitha Akki
Greenhorn

Joined: Aug 03, 2012
Posts: 24




Here when the p1.clone() call is made, it checks whether the Objects' class is implementing Cloneable interface, then comes the actual call definition where the return super.clone() is made.
Can some brief out why it is made as super.clone() and how will it make the cloning of the object.
Suresh Sajja
Ranch Hand

Joined: May 12, 2009
Posts: 34

Invoking super.clone will eventually invoke Object’s clone method,
Object's clone method first verifies if class of this object implements cloneable, then creates new instance of the class and initializes all the fields with same values as in original object.


~Suresh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clone concept doubt
 
Similar Threads
simple........
Clone an object and compare it with the oldest one
Interview question
Object cast in Prototype pattern
Why PROTECTED method in class Object?