Java Data Type Tutorial - 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 ww w .  j  a  v  a 2s .c o  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.