[/url] [url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview
Class
JavaTM 2 Platform
Std. Ed. v1.4.2
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
java.util
Class Currencyjava.lang.Object
java.util.Currency
All Implemented Interfaces: Serializable public final class Currency extends Object implements SerializableRepresents a currency. Currencies are identified by their ISO 4217 currency codes. See the ISO 4217 maintenance agency for 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: Serialized FormMethod Summary
Gets the ISO 4217 currency code of this currency. 获得当前货币的ISO 4217 货币代码。
int
Gets the default number of fraction digits used with this currency. 获得当前货币小数部分的默认位数。
static Currency
getInstance(Locale locale)
Returns the Currency instance for the country of the given locale. 返回给定locale的国家的Currency实例。
static Currency
getInstance(String currencyCode)
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的货币符号。
toString()
Returns the ISO 4217 currency code of this currency. 返回当前货币的ISO 4217 货币代码。
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Method Detail
getInstancepublic static Currency getInstance(String currencyCode)
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: NullPointerException - if currencyCode is null 如果currencyCode为null时抛出 IllegalArgumentException - if currencyCode is not a supported ISO 4217 code. 如果currencyCode不受ISO 4217代码支持时抛出getInstancepublic static Currency getInstance(Locale locale)
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: NullPointerException - if locale or its country code is null 如果locale或者它的国家代码为null时抛出 IllegalArgumentException - if the country of the given locale is not a supported ISO 3166 country code. 如果ISO 3166国家代码不支持给定locale的国家时抛出。getCurrencyCodepublic String getCurrencyCode()
Gets the ISO 4217 currency code of this currency. 获得当前货币的ISO 4217 货币代码。
Returns: the ISO 4217 currency code of this currency. 当前货币的ISO 4217 货币代码。getSymbolpublic String getSymbol()
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的货币符号getSymbolpublic String getSymbol(Locale locale)
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: NullPointerException - if locale is null 如果locale为null时抛出getDefaultFractionDigitspublic 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 当前货币小数部分的默认位数。toStringpublic String toString()
Returns the ISO 4217 currency code of this currency. 返回当前locale的货币符号。
Overrides: toString in class ObjectReturns: the ISO 4217 currency code of this currency 当前locale的货币符号[/url][url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview
Class
JavaTM 2 Platform
Std. Ed. v1.4.2
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
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 to license terms. Also see the documentation redistribution policy.