Home > Back-end >  Java object cloning
Java object cloning

Time:04-30

Java object cloning
Public abstract class Shape implements the Cloneable {

Public Object clone () {
The Object clone=null;
Clone=super clone ();
Return clone;
}
}

Super. Clone (); What do you mean, isn't super parent class? Cloneable is an interface, the interface is not implemented! Look not to understand don't understand

CodePudding user response:

If the parent class does not implement, use a subclass implementation method, you see, finally went to the Shape of the clone method

CodePudding user response:

Compile error writing, however,

CodePudding user response:

When you compile the super clone (); There won't be an error?
  • Related