Java Format - Java NumberFormat.getCurrency()








Syntax

NumberFormat.getCurrency() has the following syntax.

public Currency getCurrency()

Example

In the following code shows how to use NumberFormat.getCurrency() method.


import java.text.NumberFormat;

public class Main {
  public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getInstance();
    System.out.println(numberFormat.getCurrency().getDisplayName());
  }
}

The code above generates the following result.