Java DecimalFormatSymbols getInternationalCurrencySymbol()方法及示例
Java中 java.text .DecimalFormatSymbols类 的 getInternationalCurrencySymbol() 方法是用来获取代表该DecimalFormatSymbols的国际货币符号的字符串。该方法返回该DecimalFormatSymbols的国际货币符号的ISO 4217货币代码。
语法。
public String getInternationalCurrencySymbol()
参数。此方法不接受任何参数。
返回值。该方法返回国际货币符号的 ISO 4217货币代码 ,该符号为DecimalFormatSymbols的默认Locale。
异常。此方法不抛出任何异常。
程序。
// Java program to demonstrate// the above method import java.text.*;import java.util.*; public class DecimalFormatSymbolsDemo { public static void main(String[] args) { DecimalFormatSymbols dfs = new DecimalFormatSymbols(); System.out.println( "Character used for" + " international currency symbol: " + dfs.getInternationalCurrencySymbol()); }}
输出:
Character used for international currency symbol: USD
参考资料: https://docs.oracle.com/javase/9/docs/api/java/text/DecimalFormatSymbols.html#getInternationalCurrencySymbol-
