Java Currency getDefaultFractionDigits() 方法

2024年11月8日 | 2 分钟阅读

getDefaultFractionDigits()Java Currency 类 的一个方法,用于获取调用货币通常使用的十进制小数点后的位数。例如,美元通常使用的分数位数是 2。

语法

以下是 getDeafaultFractionDigits() 方法的声明

参数

数据类型参数描述
不适用不适用此方法不接受任何参数。

返回值

getDeafaultFractionDigits() 方法返回调用货币通常使用的十进制小数点后的位数。

异常

不适用

兼容版本

Java 1.4 及以上版本。

示例 1

输出

Default number of fraction digit of Indian currency is = 2

示例 2

输出

Default fractional digits of US Dollar: 2

示例 3

输出

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

示例 4

输出

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