Java Currency toString Example


Syntax is : public String toString()
Method returns the string representation for ISO 4217 currency code of this currency.

Here is the code.

/**
 * @(#) ToStringCurrency.java
 * A class representing use of method toString() of Currency class
 in java.util Package.
 * @Version  21-May-2008
 @author   Rose India Team
 */
import java.util.*;

class ToStringCurrency {
    public static void mainString args[] ){
        /* There is no default constructor available so use getInstance() method
      to create object of Currency object. */
        Currency curr = Currency.getInstance("INR");
      // For more currency code visit http://www.currencysystem.com/codes
        String strValue = curr.toString();
        System.out.println"String value of given currency Code is = "+strValue);
  }
}

Output of the program.
String value of given currency Code is = INR

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US