File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes cloning failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cloning failed" Watch "cloning failed" New topic
Author

cloning failed

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


java.lang.CloneNotSupportedException: ObjectClassMethods


My one regret in life is that I am not someone else.
- Woody Allen
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

You have to declare you class to implement Cloneable. You also have to provide a public Object clone() method (or public MyClass clone()). That method should use super.clone() to create a new object, and then do any additional tweaking necessary, such as deep-copying mutable fields if desired.
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Thank you :
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

In the future please SearchFirst(←click). There are bound to be plenty of examples of cloning out there.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cloning failed
 
Similar Threads
question about exceptions
Generic Binary Search Tree
Java Package
closing Connection before returning ResultSet
Circular List