DecimalFormat SetNegativeSuffix() Example
Set the negative suffix.
DecimalFormatclass SetNegativeSuffix() method example. This example shows you how to use SetNegativeSuffix() method.This method Set the negative suffix.
Here is the code:-
/**
* @Program that Set the negative suffix.
* SetNegativeSuffix.java
* Author:-RoseIndia Team
* Date:-13-Jun-2008
*/
import java.text.*;
public class SetNegativeSuffix {
public static void main(String[] args) {
// Creates a DecimalFormat object
DecimalFormat d = new DecimalFormat("0.00;0.00-");
//Get the negative suffix.
String s=d.getNegativeSuffix();
System.out.println("The negative suffix is: "+s);
d.setNegativeSuffix("#");
String s1=d.getNegativeSuffix();
System.out.println("The negative suffix is: "+s1);
}
} |
Output of the Program
The negative suffix is: -
The negative suffix is: # |
|