1

While checking the source code of Java's object class, i am confused that if its the topmost non-abstract class in hierarchy, how can we leave the clone() method unimplemented? I understand that Cloneable interface acts as a marker interface to indicate that its legal to clone that particular object which implements Cloneable, just not able to find the implementation of the clone() method. Is it a part of the JVM?

Parantap Sharma
  • 353
  • 3
  • 16

1 Answers1

3

It's defined as protected native Object clone() throws CloneNotSupportedException;

Being a native method, its implementation is not visible in the java sources.

Kayaman
  • 72,141
  • 5
  • 83
  • 121
  • 1
    the answer here tells where to find the source code, it is actually part of JVM: http://stackoverflow.com/questions/12032292/is-it-possible-to-find-the-source-for-a-java-native-method – diidu May 23 '16 at 11:43