Java Locale.getDefault()

Syntax

Locale.getDefault() has the following syntax.

public static Locale getDefault()

Example

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


/*from  w ww . j a  v  a 2  s  . com*/

import java.util.Locale;

public class Main {

   public static void main(String[] args) {
      Locale locale = Locale.getDefault();

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

   }
}

The code above generates the following result.