java.util.Currency getNumericCode()
Description
The getNumericCode() method of Currency class is use to get the ISO 4217 currency code of this currency.
Method Syntax
public int getNumericCode()
Method Argument
| Data Type | Parameter | Description |
|---|---|---|
| N/A | N/A | N/A |
Method Returns
The getNumericCode() method of Currency class returns the ISO 4217 numeric code of this currency
Compatibility
Java 1.7
Java Currency getNumericCode() Example
Below is a simple java example on the usage of getNumericCode() method of Currency class.
package com.javatutorialhq.java.examples;
import static java.lang.System.*;
import java.util.Currency;
import java.util.Set;
/*
* This example source code demonstrates the use of
* getNumericCode() method of Currency class.
*/
public class CurrencyGetNumericCodeExample {
public static void main(String[] args) {
// get all available currencies
Set setCurrency = Currency.getAvailableCurrencies();
// print details on all the currency
for (Currency currency : setCurrency) {
out.println(currency.getNumericCode() + "-"
+ currency.getDisplayName());
}
}
}
Basically on the above example, we have enumerated all the Currencies together with their numeric code.
