Java API Tutorial - Java Locale.getISOLanguages()








Syntax

Locale.getISOLanguages() has the following syntax.

public static String [] getISOLanguages()

Example

In the following code shows how to use Locale.getISOLanguages() method.

//  ww  w  .ja v a2s  .co m

import java.util.Locale;

public class Main {

   public static void main(String[] args) {
      Locale locale = new Locale("en", "US", "WIN");

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

      // get ISO languages
      String[] languages = Locale.getISOLanguages();

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

The code above generates the following result.