Java Currency class

Introduction

Java Currency tracks the settings for currency related information in Java.


// Demonstrate Currency.
import java.util.Currency;
import java.util.Locale;

public class Main {
  public static void main(String args[]) {
    Currency c;//from  w  ww. j a v a  2  s.  co m

    c = Currency.getInstance(Locale.US);

    System.out.println("Symbol: " + c.getSymbol());
    System.out.println("Default fractional digits: " + c.getDefaultFractionDigits());
  }
}



PreviousNext

Related