Currency getNumericCode() in Java

getNumericCode(): This method is available in java.util.Currency class of Java.

Syntax:

int java.util.Currency.getNumericCode()

This method returns the ISO 4217 numeric code of this currency.

Parameters: NA

Returns: the ISO 4217 numeric code of this currency.

Exceptions: NA

Approach

Java

import java.util.Currency;
import java.util.Locale;

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

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

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

    }
}

Output:

840


No comments:

Post a Comment