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