DecimalFormatSymbols SetPercent() Example
Sets the character used for percent sign.
DecimalFormatSymbolsclass SetPercent() method example. This example shows you how to use SetPercent() method.This method Sets the character used for percent sign.
Here is the code:-
/**
* @Program that Sets the character used for percent sign.
* SetPercent.java
* Author:-RoseIndia Team
* Date:-14-Jun-2008
*/
import java.text.*;
public class SetPercent {
public static void main(String[] args) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
//Gets the character used for percent sign.
char c = dfs.getPercent();
System.out.println("The character used for percent sign is: " + c);
dfs.setPercent('@');
System.out.println("The character used for percent sign is: " +dfs.getPercent());
}
} |
Output of the program:-
The character used for percent sign is: %
The character used for percent sign is: @ |
|