The getCurrencyCode() method is used to get the ISO 4217 currency code of a given currency.
Package: java.util
Java Platform: Java SE 8
Syntax:
getCurrencyCode()Return Value:
The ISO 4217 currency code of this currency.
Return Value Type: String
Example: Java Currency class - getCurrencyCode() Method
The following example fills a Java Currency class: getCurrencyCode() Method
import java.util.*;
public class Main {
public static void main(String args[]) {
// create a currency with ETB code (ethiopian)
Currency curr = Currency.getInstance("ETB");
// Gets the ISO 4217 currency code and print it
String cur_Code = curr.getCurrencyCode();
System.out.println("Currency Code is = " + cur_Code);
}
}
Output:
Currency Code is = ETB
Java Code Editor:
Previous:getAvailablecurrencies Method
Next:getDefaultfractiondigits Method
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4