Java Data Type Tutorial - Java Currency.getSymbol()








Syntax

Currency.getSymbol() has the following syntax.

public String getSymbol()

Example

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

//from   w w  w.j av  a2s  .c  o  m
import java.util.Currency;

public class Main {

   public static void main(String args[]) {

      // create a currency for euro
      Currency curr = Currency.getInstance("EUR");

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

The code above generates the following result.