package org.kodejava.util;
import java.util.Currency;
import java.util.Locale;
public class CurrencySymbol {
public static void main(String[] args) {
Currency currency = Currency.getInstance(Locale.JAPAN);
System.out.println("Japan = " + currency.getSymbol());
currency = Currency.getInstance(Locale.UK);
System.out.println("UK = " + currency.getSymbol());
currency = Currency.getInstance(Locale.US);
System.out.println("US = " + currency.getSymbol());
currency = Currency.getInstance(new Locale("in", "ID"));
System.out.println("Indonesia = " + currency.getSymbol());
}
}
The result of the code snippet above:
Japan = ¥
UK = £
US = $
Indonesia = IDR
Latest posts by Wayan (see all)
- How do I get number of each day for a certain month in Java? - September 8, 2024
- How do I get operating system process information using ProcessHandle? - July 22, 2024
- How do I sum a BigDecimal property of a list of objects using Java Stream API? - July 22, 2024
Thank you very much for this simple and clear example! Helped me a lot to resolve one problem.