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