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;
/*from  w w  w .  j ava 2 s .c om*/
public class Main {
  public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
    System.out.println(numberFormat.getCurrency().getDisplayName());
  }
}




















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat