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.
/* w w w. j a v a 2s. com*/
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.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »