Locale object is a representation of geographical, political, or cultural region. We can get and set our default locale through the java programs. For setting or getting default Locale we need to call static method getDefault() of Locale.
Java get default Locale
Locale object is a representation of geographical, political, or cultural region. We can get and set our default locale through the java programs. For setting or getting default Locale we need to call static method getDefault() of Locale.
Locale locale = Locale.getDefault();
Above line of code gets the default method now we can print this default locale value. Here is the full example code of GetDefaultLocale.java as follows:
GetDefaultLocale.java
import java.util.*;
|
Output:
C:\javaexamples>javac GetDefaultLocale.java C:\javaexamples>java GetDefaultLocale en_US |