Java Currency getDefaultFractionDigits Example


Syntax is : public int getDefaultFractionDigits()
Method returns the default number of fraction digits used with this currency. The default number of fraction digits for the Euro is 2, for the Japanese Yen it's 0. In the case of pseudo-currencies, such as IMF Special Drawing Rights, -1 is returned.

Here is the code.

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

class GetDefaultFractionDigitsCurrency {
    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
    int fValue = curr.getDefaultFractionDigits()// Method call.
    System.out.println"default number for this currency is = " + fValue);
  }
}

Output of the program.
default number for this currency is = 2

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

HOME | COPYRIGHT | CONTACT US