|
Do you need help with your Java programming?
Click here for instant help with your Java code. |
Getting Currency Symbols
This example shows how to get the currency symbols for different countries. The code below displays the currency symbols for three countries, US, UK and France. |
package com.javadb.examples; import java.util.Currency; import java.util.Locale; /** * * @author www.javadb.com */ public class Main { public void displayCurrencySymbols() { Currency currency = Currency.getInstance(Locale.US); System.out.println("United States: " + currency.getSymbol()); currency = Currency.getInstance(Locale.UK); System.out.println("United Kingdom: " + currency.getSymbol()); currency = Currency.getInstance(Locale.FRANCE); System.out.println("France: " + currency.getSymbol()); } public static void main(String[] args) { new Main().displayCurrencySymbols(); } } |
The output from the code example: |
United States: USD United Kingdom: GBP France: € |
| Do you know your Java? | |
| Take a Ten-Question-Java-Quiz! | |
Search for code examples on this site
