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.


//from  w w w. j a v  a  2s. co  m
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());
  }
}




















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat