Java Currency.getInstance(String currencyCode)

 Posted On  | Yashwant Chavan 

In this tutorial, You will learn about Java Currency.getInstance(String currencyCode) Method. Which returns the Currency instance for the given currency code.


Returns the Currency instance for the given currency code.

Currency java.util.Currency.getInstance(String currencyCode)


currencyCode the ISO 4217 code of the currency.


return the Currency instance for the given currency code.


NullPointerException - if currencyCode is null

IllegalArgumentException - if currencyCode is not a supported ISO 4217 code.

Java Currency.getCurrencyCode() example

Refer below steps

  • Create Currency instance using Currency.getInstance(Locale locale) method.
  • Print currency code using Currency.getCurrencyCode() method.

import java.util.Currency;

public class JavaCurrencyGetInstance {

    public static void main(String[] args) {

        Currency us = Currency.getInstance("USD");
        System.out.println("Currency code US:- " + us);

        Currency gbp = Currency.getInstance("GBP");
        System.out.println("Currency code GBP:- " + gbp);



Currency code US:- USD
Currency code GBP:- GBP

Promote your Blog, Website, or services on, My paypal id:

Payment will be accepted through paypal only.

© 2017

 |  Find us on Google+ |  Rss Feed

Loaded in 0.0299 seconds.