aspose file tools*
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
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Object clone()