Home » Java Double hashCode() Method with Examples

Java Double hashCode() Method with Examples

by Online Tutorials Library

Java Double hashCode() method

The hashCode() method of Java Double class returns the hash code for this Double.

The result is obtained by performing exclusive OR operation on two halves of the long integer bit representation which is same as produced by the doubleToLongBits() method.

Overrides

The hashCode() method of class Double overrides the hashCode() method of class Object

Syntax

Parameters

1.NA

2.value – is the double value provided to hash

Return value

This method returns a hash code value for this double object.

Example 1

Test it Now

Output:

1. Hash Value = -1330324172    2. Hash Value = 1079230464    3. Hash Value = -482480461    4. Hash Value = 1637418694  

Example 2

Test it Now

Output:

Enter your Adhar card No  5678  Your visit id is: 1085681152  

Example 3

Test it Now

Output:

HAsh code value = 1079476224  Float value  = 1079476224  

Example 4

Test it Now

Output:

Error:(12, 35) java: incompatible types: int cannot be converted to java.lang.Double  

Next TopicJava Double

You may also like