I usually study java source to learn how it work at backend. But when I saw the Oject class I only found the method declaration and no definitions. Can anyone tell the reason or can provide the source for Oject class containing all methosddefinitions.
Mahesh Kedari wrote:You need to add sources jar along with your binary jar into IDE for viewing the source code if not added by default.
I know that, I have the Oject.java file but there are method definitons inside. Then where are the common methods like Equal and Hashcode are defined. Because only their declaration is present as seen in source file. Please check and let me know.
Ganesh Gore wrote:Then where are the common methods like Equal and Hashcode are defined. Because only their declaration is present as seen in source file.
Where did you get the source file from ? The one in the src.zip in the JDK contains an implementation for equals().
That is because, as Jesper de Jong has already pointed, native methods do not have code in Java file, and equals method is not a native method (other such methods are toString, finalize etc.).
I hope this helps.
I know that. If you read the part of Ganesh's post that I quoted, he was saying that the source code he had did not have an implementation for the equals method. I was asking him where he got that source code from because the source code in src.zip in the JDK does have an implementation of the equals method.