Double.hashCode() in Java

Double.hashCode(): This method is available in java.lang.Double class of Java.

Syntax:

int java.lang.Double.hashCode(double value)

This method takes one argument of type double as its parameter. This method returns a hash code for a double value.

Parameters: One parameter is required for this method.

value: the value to hash.

Returns: a hash code value for a double value.

For Example:

double value = 15.7

Double.hashCode(value) = > It returns  642318336.

Approach

Java

public class DoublehashCode {
    public static void main(String[] args) {

        double value = 15.7;
        System.out.println(Double.hashCode(value));

    }
}

Output:

642318336

No comments:

Post a Comment