Internationalizing Currency (I18N with Currency)As we have internationalize the date, time and numbers, we can internationalize the currency also. The currency differs from one country to another so we need to internationalize the currency. The NumberFormat class provides methods to format the currency according to the locale. The getCurrencyInstance() method of the NumberFormat class returns the instance of the NumberFormat class. The syntax of the getCurrencyInstance() method is given below: Example of Internationalizing CurrencyIn this example, we are internationalizing the currency. The format method of the NumberFormat class formats the double value into the locale specific currency. Output:£10,500.32 for the locale en_GB $10,500.32 for the locale en_US 10 500,32 £ for the locale fr_FR Next TopicJava Interview Questions |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India