NumberFormat.getCurrencyInstance(); : NumberFormat « java.text « Java by API






NumberFormat.getCurrencyInstance();

  


import java.text.NumberFormat;

public class Mortgage {
  public static void main(String[] args) {
    double payment = Math.random() * 1000;
    System.out.println("Your payment is ");
    NumberFormat nf = NumberFormat.getCurrencyInstance();
    System.out.println(nf.format(payment));
  }
}
   

   
    
  








Related examples in the same category

1.NumberFormat: format(Object obj)
2.NumberFormat: getCurrencyInstance(Locale.UK)
3.NumberFormat: getInstance()
4.NumberFormat: getNumberInstance()
5.NumberFormat: getNumberInstance(Locale.FRENCH)
6.NumberFormat: getIntegerInstance(Locale.ITALIAN)
7.NumberFormat: getNumberInstance(Locale inLocale)
8.NumberFormat: getPercentInstance(Locale inLocale)
9.NumberFormat: parse(String source)
10.NumberFormat.setMaximumFractionDigits(int newValue)
11.NumberFormat: setMinimumFractionDigits(int newValue)
12.NumberFormat: setMinimumIntegerDigits(int newValue)
13.NumberFormat: setParseIntegerOnly(boolean value)