ServiceLoader hashCode() in Java

hashCode(): This method is available in java.util.ServiceLoader 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.ServiceLoader;

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

        ServiceLoader<String> serviceLoader =
ServiceLoader.load(String.class);

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

}

Output:

405662939


No comments:

Post a Comment