Java Currency.getSymbol(Locale locale)

Syntax

Currency.getSymbol(Locale locale) has the following syntax.

public String getSymbol(Locale locale)

Example

In the following code shows how to use Currency.getSymbol(Locale locale) method.


/*from   w w  w . j av a2s .co m*/


import java.util.Currency;
import java.util.Locale;

public class Main {

   public static void main(String args[]) {

      // create a currency for uk locale
      Locale locale = Locale.UK;
      Currency curr = Currency.getInstance(locale);

      // get and print the symbol of the currency
      System.out.println("Currency symbol is = " + curr.getSymbol(locale));
   }
}

The code above generates the following result.