DecimalFormat SetDecimalSeparatorAlwaysShown() Example
Allows you to set the behavior of the decimal separator with integers.
DecimalFormatclass SetDecimalSeparatorAlwaysShown() method example. This example shows you how to use SetDecimalSeparatorAlwaysShown() method.This method Allows you to set the behavior of the decimal separator with integers.
Here is the code:-
/**
* @Program that Allows you to set the behavior of the decimal separator with integers.
* SetDecimalSeparatorAlwaysShown.java
* Author:-RoseIndia Team
* Date:-13-Jun-2008
*/
import java.text.*;
public class SetDecimalSeparatorAlwaysShown {
public static void main(String[] args) {
// Creates a DecimalFormat object
DecimalFormat d = new DecimalFormat("365.532");
//Get the behavior of the decimal separator with integers.
System.out.println("IsDecimalSeparatorAlwaysShown is: "+d.isDecimalSeparatorAlwaysShown());
//Set the behavior of the decimal separator with integers.
d.setDecimalSeparatorAlwaysShown(false);
System.out.println("IsDecimalSeparatorAlwaysShown is: "+d.isDecimalSeparatorAlwaysShown());
}
} |
Output of the Program
IsDecimalSeparatorAlwaysShown is: true
IsDecimalSeparatorAlwaysShown is: false |
|