Java Format - Java NumberFormat.getInstance()








Syntax

NumberFormat.getInstance() has the following syntax.

public static final NumberFormat getInstance()

Example

In the following code shows how to use NumberFormat.getInstance() 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.