Random hashCode() in Java

hashCode(): This method is available in java.util.Random class of Java.

Syntax:

int java.lang.Object.hashCode()

This method returns a hash code value for the object.

Parameters: NA

Returns: a hash code value for this object.

Exceptions: NA

Approach

Java

import java.util.Random;

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

        Random random = new Random();

        System.out.println(random.hashCode());
    }
}

Output:

1130478920


No comments:

Post a Comment