Java Format - Java NumberFormat .getCurrencyInstance ()








Syntax

NumberFormat.getCurrencyInstance() has the following syntax.

public static final NumberFormat getCurrencyInstance()

Example

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

import java.text.NumberFormat;

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

The code above generates the following result.