Java.util.Currency.getDefaultFractionDigits() 方法


Java.util.Currency.getDefaultFractionDigits() 方法

package com.codingdict;

import java.util.*;

public class CurrencyDemo {
   public static void main(String args[]) {

      // create 2 different currencies
      Currency curr1 = Currency.getInstance("USD");
      Currency curr2 = Currency.getInstance("JPY");

      // print their fraction digits
      int usdDigits = curr1.getDefaultFractionDigits();
      System.out.println("USD fraction digits:" + usdDigits);
      int jpyDigits = curr2.getDefaultFractionDigits();
      System.out.println("JPY fraction digits:" + jpyDigits);
   }
}