Java Currency.toString()

Syntax

Currency.toString() has the following syntax.

public String toString()

Example

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


//from   ww w  .jav a 2s  . co  m


import java.util.Currency;

public class Main {

   public static void main(String[] args) {

      // create a currency with specified currency code
      Currency curr = Currency.getInstance("USD");

      System.out.println(curr.toString());
   }
}

The code above generates the following result.