DecimalFormatSymbols SetCurrencySymbol() Example
Sets the currency symbol for the currency of these DecimalFormatSymbols in their locale.
DecimalFormatSymbolsclass SetCurrencySymbol() method example. This example shows you how to use SetCurrencySymbol() method.This method Sets the currency symbol for the currency of these DecimalFormatSymbols in their locale.
Here is the code:-
/**
* @Program that Sets the currency symbol for the currency of these
* DecimalFormatSymbols in their locale.
* SetCurrencySymbol.java
* Author:-RoseIndia Team
* Date:-14-Jun-2008
*/
import java.text.*;
import java.util.*;
public class SetCurrencySymbol {
public static void main(String[] args) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols(new Locale("English"));
String s=dfs.getCurrencySymbol();
System.out.println("currency symbol for the currency: "+s);
//Sets the currency symbol for the currency
dfs.setCurrencySymbol("&");
String s1=dfs.getCurrencySymbol();
System.out.println("currency symbol for the currency: "+s1);
}
} |
Output of the Program
currency symbol for the currency: ¤
currency symbol for the currency: & |
|