• Post Reply Bookmark Topic Watch Topic
  • New Topic

about hashcode()  RSS feed

 
Santhi Bharath
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
friends,

while an object of any class println() diplaying a value something like this

classname@somehexadecimalstringof-hashcode

but, while observing the Object class i can't find any implementation of hashcode();

but found a 'native' method of hashcode();

then where the hashcode of particular object comes from???
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Object's hashCode() is indeed "native", which means here that it's implemented in the JVM itself (in C or assembly language, for example). But other classes can override this method in Java -- for example, java.lang.String does so. That version computes the hash code from the characters of the String.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!