Harshana Dias wrote:Where is the implementation for above which should return the hexadecimal value of the memory address
Answer: Dunno and don't care; and neither should you.
The only possible reason I can imagine that you'd want to know this information is that you want to use it in some way; and all I can advise you is: DON'T.
At best it's a bad idea, and at worst it's dangerous.
And, as Paul already pointed out, your assertion of what it "should" do is wrong anyway.
Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here
Joined: Jun 11, 2007
Paul Clapham wrote:The implementation of the method is in native code -- that's code which isn't written in Java but in some underlying language which interfaces with the operating system the JVM is designed to use.
And your assertion that the hashCode "should return the hexadecimal value of the memory address" isn't quite correct. What the API documentation actually says is this:
Thank you both of you. If possible can you tell me an example of a "some underlying language"? Suppose i am running on windows xp or 7?
If you really want to see the source code, you can find it in the OpenJDK project. It's probably written in C++. Note that this is not an easy project to understand, and certainly something that will be way over your head if you're not a really experienced programmer.