Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

clone() not visible ??

 
henry wu
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to use the clone() method and I'm getting this error message :
The method clone() from the type java.lang.Object is not visible.
I'm added the "implements Cloneable" to the base class and the subclass of the object created. Any suggestions?
Henry
 
henry wu
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to add that in the class that I'm trying to clone I have :
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
I'll try replacing return super.clone(); with some code and see what happens.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic