DecimalFormat GetMaximumFractionDigits() Example
Gets the maximum number of digits allowed in the fraction portion of a number
DecimalFormatclass GetMaximumFractionDigits() method example. This example shows you how to use GetMaximumFractionDigits() method.This method Gets the maximum number of digits allowed in the fraction portion of a number
Here is the code:-
/**
* @Program that Gets the maximum number of digits allowed in the fraction
* portion of a number.
* GetMaximumFractionDigits.java
* Author:-RoseIndia Team
* Date:-12-Jun-2008
*/
import java.text.*;
public class GetMaximumFractionDigits {
public static void main(String[] args) {
// Creates a DecimalFormat object
DecimalFormat d = new DecimalFormat();
//Gets the maximum number of digits allowed in the fraction portion of a number.
System.out.println("The digits allowed in the fraction portion of a number is: "
+ d.getMaximumFractionDigits());
}
} |
Output of the Program
| The digits allowed in the fraction portion of a number is: 3 |
|