Java.util.Currency Class

Advertisements


Introduction

The java.util.Currency class represents a currency.Following are the important points about 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, this is the reason behind no public constructor.

Class declaration

Following is the declaration for java.util.Currency class:

public final class Currency
   extends Object
      implements Serializable

Class methods

S.N.Method & Description
1 String getCurrencyCode()
This method gets the ISO 4217 currency code of this currency.
2 int getDefaultFractionDigits()
This method gets the default number of fraction digits used with this currency.
3 static Currency getInstance(Locale locale)
This method returns the Currency instance for the country of the given locale.
4 static Currency getInstance(String currencyCode)
This method returns the Currency instance for the given currency code.
5 String getSymbol()
This method gets the symbol of this currency for the default locale.
6 String getSymbol(Locale locale)
This method gets the symbol of this currency for the specified locale.
7 String toString()
This method returns the ISO 4217 currency code of this currency.

Methods inherited

This class inherits methods from the following classes:

  • java.util.Object




Advertisements
Advertisements