Locale hashCode() in Java

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

Syntax:

int java.util.Locale.hashCode()

This method returns the hashcode value.

Returns: a hash code value for this object.

For Example:

Locale locale = new Locale("en", "USA", "US")

locale.hashCode() = > It returns 99169362.

Approach

Java

import java.util.Locale;

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

        Locale locale = new Locale("en""USA""US");

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

Output:

99169362

No comments:

Post a Comment