java currency 默认_java.util.Currency翻译

java.util

Class Currency

java.lang.Object

0818b9ca8b590ca3270a3433284dd417.pngjava.util.Currency

All Implemented Interfaces:

public final class Currency

extends

Object

Represents a currency. Currencies are identified by their ISO 4217 currency codes. See theISO 4217 maintenance agencyfor more information, including a table of currency codes. 代表货币。货币按照ISO 4217货币代码区分。更多信息参见ISO 4217 maintenance agency,包括货币代码表。

The class is designed so that there's never more than one Currency instance for any given currency. Therefore, there's no public constructor. You obtain a Currency instance using the getInstance methods. 该类被设计为对于任何给定的货币,只能得到一个Currency实例。因此,它没有公共的构造函数。 你可以使用getInstance方法获得Currency实例。

Since:

1.4

See Also:

Method Summary

Gets the ISO 4217 currency code of this currency. 获得当前货币的ISO 4217 货币代码。

int

Gets the default number of fraction digits used with this currency. 获得当前货币小数部分的默认位数。

Returns the Currency instance for the country of the given locale. 返回给定locale的国家的Currency实例。

Returns the Currency instance for the given currency code. 返回指定货币代码的Currency实例。

Gets the symbol of this currency for the default locale. 获得默认locale的货币符号。

Gets the symbol of this currency for the specified locale. 获得指定locale的货币符号。

Returns the ISO 4217 currency code of this currency. 返回当前货币的ISO 4217 货币代码。

Method Detail

getInstance

public staticCurrencygetInstance(StringcurrencyCode)

Returns the Currency instance for the given currency code. 返回指定货币代码的Currency实例。

Parameters:

currencyCode - the ISO 4217 code of the currency 货币的ISO 4217代码

Returns:

the Currency instance for the given currency code 指定货币代码的Currency实例

Throws:

- if currencyCode is null 如果currencyCode为null时抛出

- if currencyCode is not a supported ISO 4217 code. 如果currencyCode不受ISO 4217代码支持时抛出

getInstance

public staticCurrencygetInstance(Localelocale)

Returns the Currency instance for the country of the given locale. The language and variant components of the locale are ignored. The result may vary over time, as countries change their currencies. For example, for the original member countries of the European Monetary Union, the method returns the old national currencies until December 31, 2001, and the Euro from January 1, 2002, local time of the respective countries. 返回给定locale的国家的Currency实例。locale的语言和不同组成被忽略。随着时间不同, 结果可能多种多样,因为国家会改变它们的货币。比如,对于欧盟的最初成员国而言, 该方法在2001年12月31日前,返回旧的国家货币,2002年1月1日以后,返回欧元(各国当地时间)。

The method returns null for territories that don't have a currency, such as Antarctica. 对于没有货币的领域,比如南极洲,方法返回null。

Parameters:

locale - the locale for whose country a Currency instance is needed 需要给定国家的Currency实例的locale

Returns:

the Currency instance for the country of the given locale, or null 给定locale的国家的Currency实例,或者为null

Throws:

- if locale or its country code is null 如果locale或者它的国家代码为null时抛出

- if the country of the given locale is not a supported ISO 3166 country code. 如果ISO 3166国家代码不支持给定locale的国家时抛出。

getCurrencyCode

publicStringgetCurrencyCode()

Gets the ISO 4217 currency code of this currency. 获得当前货币的ISO 4217 货币代码。

Returns:

the ISO 4217 currency code of this currency. 当前货币的ISO 4217 货币代码。

getSymbol

publicStringgetSymbol()

Gets the symbol of this currency for the default locale. For example, for the US Dollar, the symbol is "$" if the default locale is the US, while for other locales it may be "US$". If no symbol can be determined, the ISO 4217 currency code is returned. 获得默认locale的货币符号。例如如果默认locale是US,对于美元,符号是“$”, 当然其他locale也可能是“US$”。如果不能确定符号,返回ISO 4217货币代码。

Returns:

the symbol of this currency for the default locale 默认locale的货币符号

getSymbol

publicStringgetSymbol(Localelocale)

Gets the symbol of this currency for the specified locale. For example, for the US Dollar, the symbol is "$" if the specified locale is the US, while for other locales it may be "US$". If no symbol can be determined, the ISO 4217 currency code is returned. 获得指定locale的货币符号。例如如果默认locale是US,对于美元,符号是“$”, 当然其他locale也可能是“US$”。如果不能确定符号,返回ISO 4217货币代码。

Parameters:

locale - the locale for which a display name for this currency is needed 为货币显示名称需要的locale

Returns:

the symbol of this currency for the specified locale 指定locale的货币符号

Throws:

- if locale is null 如果locale为null时抛出

getDefaultFractionDigits

public int getDefaultFractionDigits()

Gets the default number of fraction digits used with this currency. For example, the default number of fraction digits for the Euro is 2, while for the Japanese Yen it's 0. In the case of pseudo-currencies, such as IMF Special Drawing Rights, -1 is returned. 获得当前货币小数部分的默认位数。例如,欧元的小数部分默认位数为2,而日元为0。 如果是假冒货币,比如IMF Special Drawing Rights,返回-1。

Returns:

the default number of fraction digits used with this currency 当前货币小数部分的默认位数。

toString

publicStringtoString()

Returns the ISO 4217 currency code of this currency. 返回当前locale的货币符号。

Overrides:

Returns:

the ISO 4217 currency code of this currency 当前locale的货币符号

Submit a bug or feature

For further API reference and developer documentation, see

Java 2 SDK SE Developer Documentation

. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject tolicense terms. Also see thedocumentation redistribution policy.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值