Last Updated : 11 Jul, 2025
The
hashCode()method of
Double classis a built-in method use to return the hashcode value of this Double object.
Syntax:DoubleObject.hashCode()Parameters:
It takes no parameters.
Return Type:It returns an
intvalue. The value returned is
(int)(v^(v>>>32))where v is a long variable equal to
Double.doubleToLongBits(this.doubleValue()). Below is the implementation of hashCode() method:
Example 1: Java
// Java code to demonstrate
// Double hashCode() Method
class GFG {
public static void main(String[] args)
{
double d = 118.698;
// creating Double object.
Double value = new Double(d);
// hashCode() method Double class
int output = value.hashCode();
// printing the output
System.out.println("Hashcode Value of "
+ value + " : "
+ output);
}
}
Output:
Hashcode Value of 118.698 : 1215072837Example 2: Java
// Java code to demonstrate
// Double hashCode() Method
class GFG {
public static void main(String[] args)
{
int i = -30;
// creating Double object.
Double value = new Double(i);
// hashCode() method Double class
int output = value.hashCode();
// printing the output
System.out.println("Hashcode Value of "
+ value + " : "
+ output);
}
}
Output:
Hashcode Value of -30.0 : -1069678592
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4