Description
The Java Currency getDefaultFractionDigits() method gets the default number of this currency's fraction digits.
Declaration
Following is the declaration for java.util.Currency.getDefaultFractionDigits() method
Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.
Parameters
NA
Return Value
This method returns the default number of fraction digits used with this currency
Exception
NA
Getting Default Fraction Digits of EUR Currency Instance Example
The following example shows the usage of Java Currency getDefaultFractionDigits() method for EUR currency. We've first created a currency object using EUR as currency code and then its default fraction digits are printed.
Output
Let us compile and run the above program, this will produce the following result −
Default fraction digits for EUR = 2
Getting Default Fraction Digits of USD Currency Instance Example
The following example shows the usage of Java Currency getDefaultFractionDigits() method for USD currency. We've first created a currency object using USD as currency code and then its default fraction digits are printed.
Output
Let us compile and run the above program, this will produce the following result −
Default fraction digits for USD = 2
Getting Default Fraction Digits of JPY Currency Instance Example
The following example shows the usage of Java Currency getDefaultFractionDigits() method for JPY currency. We've first created a currency object using JPY as currency code and then its default fraction digits are printed.
Output
Let us compile and run the above program, this will produce the following result −
Default fraction digits for JPY = 0
'Study > Java' 카테고리의 다른 글
[Java] 자바 소수점 원하는 자리수 만큼 출력 (0) | 2024.08.11 |
---|---|
[JAVA] json String to List map (0) | 2024.08.11 |
JAVA HttpURLConnection 활용한 API 호출하기(GET, POST, DELETE) (0) | 2024.08.10 |
JAVA AES 암호화 /복호화 예제 (AES-256) (0) | 2024.08.09 |
Java에서 System.getProperty() 사용법 / 현재 디렉토리 알기 / user home 디렉토리 알기 (0) | 2024.02.06 |
댓글