Java.util.Locale.getISOCountries() 方法


Java.util.Locale.getISOCountries() 方法

package com.codingdict;

import java.util.*;

public class LocaleDemo {
   public static void main(String[] args) {

      // create a new locale
      Locale locale = new Locale("en", "US", "WIN");

      // print locale
      System.out.println("Locale:" + locale);

      // get ISO countries
      String[] countries = Locale.getISOCountries();

      // print countries
      System.out.println("Countries are:");

      for (int i = 0; i < countries.length; i++) {
         System.out.println(i + ":" + countries[i]);
      }
   }
}