Currency getDefaultFractionDigits() in Java

getDefaultFractionDigits(): This method is available in java.util.Currency class of Java.

Syntax:

int java.util.Currency.getDefaultFractionDigits()

This method gets the default number of fraction digits used with this currency.

Parameters: NA

Returns: the default number of fraction digits used with this currency.

Exceptions: NA

Approach

Java

import java.util.Currency;
import java.util.Locale;

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

        Currency currency = Currency.getInstance(Locale.US);

        System.out.println(currency.getDefaultFractionDigits());

    }
}

Output:

2


No comments:

Post a Comment