getISOCountries()
static String[] getISOCountries()
- Returns a list of all 2-letter country codes defined in ISO 3166.
import java.util.Locale;
public class MainClass {
public static void main(String args[]) throws Exception {
String [] countries = Locale.getISOCountries();
System.out.println("Countries:\n");
for (int i = 0; i < countries.length; i++)
System.out.println(countries[i]);
}
}