Java Utility Library

Java.util.Currency Class



Java Currency Class

Java.util package provides a Currency class which represents a currency. Currencies are identified by their ISO 4217 currency codes. The class is designed so that there's never more than one Currency instance for any given currency. Therefore, there's no public constructor.

Class declaration

The declaration of java.util.Currency class is:

public final class Currency
  extends Object
    implements Serializable

java.util.Currency Methods

The java.util.Currency class has a number of methods which are listed below:

Member Methods

S.NMethods & Description
1. static Set<Currency> getAvailableCurrencies()
Gets the set of available currencies.
2. String getCurrencyCode()
Gets the ISO 4217 currency code of this currency.
3. int getDefaultFractionDigits()
Gets the default number of fraction digits used with this currency.
4. String getDisplayName()
Gets the name that is suitable for displaying this currency for the default DISPLAY locale.
5. String getDisplayName(Locale locale)
Gets the name that is suitable for displaying this currency for the specified locale.
6. static Currency getInstance(Locale locale)
Returns the Currency instance for the country of the given locale.
7. static Currency getInstance(String currencyCode)
Returns the Currency instance for the given currency code.
8. int getNumericCode()
Returns the ISO 4217 numeric code of this currency.
9. String getSymbol()
Gets the symbol of this currency for the default DISPLAY locale.
10. String getSymbol(Locale locale)
Gets the symbol of this currency for the specified locale.
11. String toString()
Returns the ISO 4217 currency code of this currency.

Methods inherited

This class inherits the methods of following class:

  • java.lang.Object