NumberFormat GetAvailableLocales() Example
Returns an array of all locales
NumberFormatclass GetAvailableLocales() method example. This example shows you how to use GetAvailableLocales() method.This method Returns an array of all locales
Here is the code:-
/**
* @Program that Returns an array of all locales
* GetAvailableLocales.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
import java.util.*;
public class GetAvailableLocales {
public static void main(String[] args) {
//Creating Numberformat instance
NumberFormat nf = NumberFormat.getInstance();
//Returns an array of all locales
Locale[] l = nf.getAvailableLocales();
System.out.println("Array of all locales is: ");
for (int i = 0; i < 15; i++) {
System.out.println(l[i]);
}
}
} |
Output of the program:-
Array of all locales is:
ja_JP
es_PE
en
ja_JP_JP
es_PA
sr_BA
mk
es_GT
ar_AE
no_NO
sq_AL
bg
ar_IQ
ar_YE
hu |
|