Forum Stats

  • 3,837,134 Users
  • 2,262,229 Discussions
  • 7,900,211 Comments

Discussions

SCJP 6: native method hashCode() source code

875947
875947 Member Posts: 1
Hello everybody!!
I am preparing for SCJP 6 ....by Kathy Sierra Book .While studying equals() and hashCode() method i'm confused about the actual implementation algorithm used for
native hashCode() method . Can anybody please tell me how to figure it-out??
or
Is there any way by which I can see the native method source code which I am not able to find in API Documentations.....

Answers

  • 796440
    796440 Member Posts: 19,179 Gold Trophy
    Why do you care about it? It won't be on the exam, and it's not part of the spec. Each implementation is free to do it their own way, as long as it meets the hashCode()/equals() contract.

    If you're really curious how the particular JVM that you're using at the moment implements it, the JVM source code--including the native code--is available for download. You may have to do some digging to find it, but I'd start with googling for something like jvm source code download.
    796440
This discussion has been closed.