Java Utility Library

Java Currency - getAvailableCurrencies() Method



The java.util.Currency.getAvailableCurrencies() method is used to get the set of available currencies. The returned set of currencies contains all of the available currencies, which may include currencies that represent obsolete ISO 4217 codes.

Syntax

public static Set<Currency> getAvailableCurrencies()

Parameters

No parameter is required.

Return Value

Returns the set of available currencies. If there is no currency available in the runtime, the returned set is empty.

Exception

NA.

Example:

In the example below, the java.util.Currency.getAvailableCurrencies() method is used to get the set of available currencies.

import java.util.*;

public class MyClass {
  public static void main(String[] args) {
    //creating the set of available currencies
    Set<Currency> CurrSet = Currency.getAvailableCurrencies();  

    //printing the set
    System.out.println("The Available Currencies are:\n" + CurrSet);
  }
}

The output of the above code will be (word wrapped for readability):

The Available Currencies are:
[SEK, SGD, NIO, RON, MOP, MZN, XAG, RWF, MRO, SSP, ZWN, GYD, LKR, MWK, MRU, 
 AMD, SOS, KPW, MVR, VEF, GTQ, KES, AZN, ROL, KRW, AZM, KYD, HUF, BMD, NLG, 
 AYM, SZL, DOP, SCR, CRC, OMR, MXN, FIM, ZMK, LTL, TZS, HKD, STN, SBD, HTG, 
 UAH, DJF, GBP, ESP, IEP, FRF, PHP, LBP, XSU, PEN, USD, MNT, RUB, JPY, VND, 
 LRD, XCD, HRK, MDL, TOP, THB, CHW, LYD, XPF, YER, ZWL, CUP, TWD, BYB, MMK, 
 CZK, DZD, AUD, BND, BOB, KMF, EGP, ARS, TRL, BWP, SDD, ZMW, VEB, JMD, USS, 
 BYN, FKP, KWD, ATS, KGS, CHE, XBA, BGN, CDF, NGN, UYI, XAU, GHS, TRY, BRL, 
 HNL, SYP, XDR, SVC, PTE, TND, IQD, NAD, WST, GEL, BGL, ALL, GIP, XOF, CLF, 
 BYR, IRR, TTD, BSD, KHR, PLN, BZD, LSL, ANG, XFU, ZWR, BAM, IDR, XPD, GHC, 
 ITL, AFA, SKK, GNF, SAR, SIT, KZT, UGX, MGF, XBB, AOA, QAR, NPR, COU, ZWD, 
 VES, YUM, XUA, ISK, CUC, BBD, AED, COP, XAF, ETB, JOD, MUR, GWP, EEK, BIF, 
 CLP, PKR, TMM, TMT, MGA, TPE, MXV, CNY, NOK, INR, NZD, PGK, TJS, MAD, SRG, 
 DKK, EUR, BTN, PAB, SDG, BEF, MTL, ILS, BOV, SLL, STD, USN, DEM, ERN, XPT, 
 GRD, CAD, VUV, BHD, PYG, FJD, LUF, MZM, SRD, GMD, MYR, UZS, BDT, CHF, UYU, 
 AFN, RSD, XFO, SHP, LVL, CSD, RUR, CYP, LAK, XBC, XTS, AWG, MKD, ADP, ZAR, 
 CVE, XBD]

❮ Java.util - Currency