Javatpoint Logo
Javatpoint Logo

Java System identityHashCode() Method

The identityHashCode() method of Java System class returns hash code for the specified object. It is returned by the default method hashCode().

Syntax

Parameter

x - object for which the hashCode is to be calculated

Returns

  1. Returns the hash code.
  2. Returns zero as reference if hash code is null.

Example 1

Test it Now

Output:

identity hash code of object a = 743673026
identity hash code of object b = 743673026
identity hash code of object c = 557722442

Example 2

Test it Now

Output:

identity hash code of object a = 843730481
identity hash code of object b = 743673026

Next TopicJava System



Help Others, Please Share

facebook twitter pinterest