Java Data Type Tutorial - Java Currency .getDefaultFractionDigits ()








Syntax

Currency.getDefaultFractionDigits() has the following syntax.

public int getDefaultFractionDigits()

Example

In the following code shows how to use Currency.getDefaultFractionDigits() method.

//  www.  ja  va  2s  . c  o  m

import java.util.Currency;

public class Main {

   public static void main(String args[]) {

      Currency curr1 = Currency.getInstance("USD");
      Currency curr2 = Currency.getInstance("JPY");

      System.out.println("USD fraction digits:" + curr1.getDefaultFractionDigits());
      System.out.println("JPY fraction digits:" + curr2.getDefaultFractionDigits());
   }
}

The code above generates the following result.