Java Data Type Tutorial - Java Currency.getCurrencyCode()








Syntax

Currency.getCurrencyCode() has the following syntax.

public String getCurrencyCode()

Example

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

/* w  ww .  j  ava 2s . c o m*/

import java.util.Currency;

public class Main {

   public static void main(String args[]) {

      // create a currency with eur code
      Currency curr = Currency.getInstance("EUR");

      // get currency code and print it
      String curCode = curr.getCurrencyCode();
      System.out.println("Currency Code is = " + curCode);
   }
}

The code above generates the following result.