NumberFormat GetInstance1() Example
Returns a general-purpose number format for the specified locale.
NumberFormatclass GetInstance1() method example. This example shows you how to use GetInstance1() method.This method Returns a general-purpose number format for the specified locale.
Here is the code:-
/**
* @Program that Returns a general-purpose number format for the specified locale.
* GetInstance1.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
import java.util.*;
public class GetInstance1 {
public static void main(String[] args) {
//Creating Numberformat instance
NumberFormat nf = NumberFormat.getInstance(Locale.CANADA);
System.out.println("Number format for the specified locale: "+nf.getCurrency());
}
} |
Output of the program:-
| Number format for the specified locale: CAD |
|