Related Examples
  1. NumberFormat SetRoundingMode() Example
  2. NumberFormat SetParseIntegerOnly() Example
  3. NumberFormat SetMinimumIntegerDigits() Example
  4. NumberFormat SetMinimumFractionDigits() Example
  5. NumberFormat SetMaximumIntegerDigits() Example
  6. NumberFormat SetMaximumFractionDigits() Example
  7. NumberFormat SetGroupingUsed() Example
  8. NumberFormat SetCurrency() Example
  9. NumberFormat ParseObject() Example
  10. NumberFormat Parse1() Example
  11. NumberFormat Parse() Example
  12. NumberFormat IsParseIntegerOnly() Example
  13. NumberFormat IsGroupingUsed() Example
  14. NumberFormat HashCode() Example
  15. NumberFormat GetRoundingMode() Example
  16. NumberFormat GetPercentInstance1() Example
  17. NumberFormat GetPercentInstance() Example
  18. NumberFormat GetNumberInstance1() Example
  19. NumberFormat GetNumberInstance() Example
  20. NumberFormat GetMinimumIntegerDigits() Example
  21. NumberFormat GetMinimumFractionDigits() Example
  22. NumberFormat GetMaximumIntegerDigits() Example
  23. NumberFormat GetMaximumFractionDigits() Example
  24. NumberFormat GetIntegerInstance1() Example
  25. NumberFormat GetIntegerInstance() Example
  26. NumberFormat GetInstance1() Example
  27. NumberFormat GetInstance() Example
  28. NumberFormat GetCurrencyInstance1() Example
  29. NumberFormat GetCurrencyInstance() Example
  30. NumberFormat GetCurrency() Example
  31. NumberFormat GetAvailableLocales() Example
  32. NumberFormat Format4() Example
  33. NumberFormat Format3() Example
  34. NumberFormat Format2() Example
  35. NumberFormat Format1() Example
  36. NumberFormat Format() Example
  37. NumberFormat Equals() Example
  38. NumberFormat Clone() Example
  39. Java Class NumberFormat, Java NumberFormat Methods, Java NumberFormat Functions,NumberFormat Examples Java

View All Examples
 

NumberFormat SetMaximumFractionDigits() Example

Sets the maximum number of digits allowed in the fraction portion of a number.


NumberFormatclass SetMaximumFractionDigits() method example. This example shows you how to use SetMaximumFractionDigits() method.This method Sets the maximum number of digits allowed in the fraction portion of a number.

Here is the code:-

/**
 * @Program that Sets the maximum number of digits allowed in the fraction 
 * portion of a number.
 * SetMaximumFractionDigits.java 
 * Author:-RoseIndia Team
 * Date:-17-Jun-2008
 */
import java.text.*;
import java.util.*;
public class SetMaximumFractionDigits {
public static void main(String[] args) {
//Creating Numberformat instance        
        NumberFormat nf = NumberFormat.getIntegerInstance();
        // Returns the maximum number of digits allowed in the fraction
        System.out.println("Maximum number of digits allowed in the fraction is: "
                +nf.getMaximumFractionDigits());
        nf.setMaximumFractionDigits(2);
        System.out.println("Maximum number of digits allowed in the fraction is: "
                +nf.getMaximumFractionDigits());
    }

}

Output of the program:-
 Maximum number of digits allowed in the fraction is: 0
Maximum number of digits allowed in the fraction is: 2

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

HOME | COPYRIGHT | CONTACT US