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 Java in General and the fly likes Object clone() 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 » Java in General
Bookmark "Object clone()" Watch "Object clone()" New topic
Author

Object clone()

Brett Anthoine
Greenhorn

Joined: Mar 12, 2002
Posts: 27
Hello,
I'm trying to get an exact copy of an object's instance. example

The problem is the compiler says clone() is protected. I'm confused.


Brett Anthoine<br />"640k should be enough for anybody."
Vijay Kashyap
Ranch Hand

Joined: Jul 30, 2001
Posts: 74
Hi Brett,
You have to supply cloning method for your TestClass.
As the clone method is protected in Object class which is your super class( if you are not extending any other class in TestClass) hence you cannot use clone method without providing definition for it.
Regards,
Vijay
[ May 22, 2002: Message edited by: vijay kashyap ]
Brett Anthoine
Greenhorn

Joined: Mar 12, 2002
Posts: 27
Thanks you vijay.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object clone()
 
Similar Threads
a question
null
class references..
Confusing code from JQ++
Interview question