Knowledge Walls
John Peter
Pune, Maharashtra, India
Difference between hashcode and identityHashCode in JAVA
10014 Views
hashCode() method identifyHashCode() method
hashCode method is a method of Object class. identifyHashCode method is a method of System class.
Object.hashCode() to get the hash code of the object. This method is basically existing in all objects. Because Object class is the root class of all Classes in JAVA. System.identifyHashCode(Object) to get the hash code of the given object. It returns the same integer of hashCode() method.

If class is overritten the hashCode() method then this System.identifyHashCode() method is to check.

Notes.

    Generally when printing java object without toString method in a Class. Getting com.google.Gson@10385c1. This number(10385c1) is hex decimal figure of hash code. It means the address reference of the object with the Class Name.
      Integer.toHexString(obj.hashCode());
Returns 10385c1 for the same object. so package.Class_name@address_in_hex it means.
Next Topics
Next lessons of current book.
Computer software engineer articles of One day One Thing to Know
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details