Currency hashCode() in Java

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

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

        Currency currency = Currency.getInstance(Locale.US);

        System.out.println(currency.hashCode());

    }
}

Output:

314337396


No comments:

Post a Comment