Java Currency getDefaultFractionDigits() Method

The getDefaultFractionDigits() is the method of Java Currency class which is used to get the number of digits after the decimal point that are normally used by the invoking currency. For example, fractional digits normally used for dollars are 2.

Syntax

Following is the declaration of getDeafaultFractionDigits() method:

Parameter

DataTypeParameterDescription
NANAThis method does not accept any parameter.

Returns

The getDeafaultFractionDigits() method returns the number of digits after the decimal point that are normally used by the invoking currency.

Exceptions

NA

Compatibility Version

Java 1.4 and above.

Example 1

Output:

Default number of fraction digit of Indian currency is = 2

Example 2

Output:

Default fractional digits of US Dollar: 2

Example 3

Output:

Japan Yen's fraction digits: 0
Hong Kong Dollar's fraction digits: 2

Example 4

Output:

Enter the Currency Name: INR
Currency is: Indian Rupee
Fraction Digit is: 2