DecimalFormatSymbols SetCurrency() Example
Sets the currency of these DecimalFormatSymbols.
DecimalFormatSymbolsclass SetCurrency() method example. This example shows you how to use SetCurrency() method.This method Sets the currency of these DecimalFormatSymbols.
Here is the code:-
/**
* @Program that Sets the currency of these DecimalFormatSymbols.
* SetCurrency.java
* Author:-RoseIndia Team
* Date:-14-Jun-2008
*/
import java.text.*;
import java.util.*;
public class SetCurrency {
public static void main(String[] args) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
String s=dfs.getCurrencySymbol();
System.out.println("The currency symbol for the currencyis :"+s);
Currency c= Currency.getInstance("USD");
//Sets the currency of these DecimalFormatSymbols.
dfs.setCurrency(c);
System.out.println("The currency symbol for the currencyis :"+c);
}
} |
Output of the Program
The currency symbol for the currencyis :Rs.
The currency symbol for the currencyis :USD |
|