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?
Asked
Active
Viewed 89 times
1
-
1Cloneable isn't used or talked about much these days. – duffymo May 23 '16 at 11:20
-
If you must make a Cloneable, read Joshua Bloch's "Effective Java". – duffymo May 23 '16 at 11:40
1 Answers
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
-
1the 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