Java Currency.toString() Method

 Posted On  | Yashwant Chavan 

In this tutorial, You will learn about Java Currency.toString() method. Which returns the ISO 4217 currency code of this currency.

syntax

Returns the ISO 4217 currency code of this currency.

String java.util.Currency.toString()

Return

return the ISO 4217 currency code of this currency.

Java Currency.toString() example

Refer below steps

  • Create Currency instance using Currency.getInstance(Locale locale) method.
  • Print currency code using toString() method.
package com.technicalkeeda.app;

import java.util.Currency;
import java.util.Locale;

public class JavaCurrencyToString {

    public static void main(String[] args) {

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

    }
}

Output

Currency toString():- USD


© technicalkeeda.com 2017

 |  Find us on Google+ |  Rss Feed

Loaded in 0.0333 seconds.