Java API Tutorial - Java Locale(String language) Constructor








Syntax

Locale(String language) constructor from Locale has the following syntax.

public Locale(String language)

Example

In the following code shows how to use Locale.Locale(String language) constructor.

import java.util.Locale;
/*from   ww  w . j av  a2 s . com*/
public class Main {

   public static void main(String[] args) {
      Locale locale = new Locale("ENGLISH");

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

      System.out.println("Display Name:" + locale.getDisplayCountry());

   }
}

The code above generates the following result.