Java API Tutorial - Java Locale.getLanguage()








Syntax

Locale.getLanguage() has the following syntax.

public String getLanguage()

Example

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

/*from   w w w. j  a  v a  2s  .c o  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 language and print it
      System.out.println("Language:" + locale.getLanguage());
   }
}

The code above generates the following result.