DecimalFormat GetCurrency() Example
Gets the currency used by this decimal format when formatting currency values.
DecimalFormatclass GetCurrency() method example. This example shows you how to use GetCurrency() method.This method Gets the currency used by this decimal format when formatting currency values.
Here is the code:-
/**
* @Program that Gets the currency used by this decimal format when formatting
* currency values.
* GetCurrency.java
* Author:-RoseIndia Team
* Date:-12-Jun-2008
*/
import java.text.*;
import java.util.*;
public class GetCurrency {
public static void main(String[] args) {
// Creates a DecimalFormat object
DecimalFormat d = new DecimalFormat();
Currency c = Currency.getInstance("INR");
//Gets the currency used by this decimal format
System.out.println("Currency used by this decimal format is : "
+d.getCurrency().getSymbol());
}
} |
Output of the Program
| Currency used by this decimal format is : Rs. |
|