Java Locale getDefault() method

The getDefault() method of Java Locale class is used to get the current value of the default locale for this instance of the JVM(Java Virtual Mchine).

Syntax

Return

It returns the default locale for this instance of the Java Virtual Machine

Example 1

Output:

Locale:en_US

Example 2

Output:

Locale1: en_US
Locale2: en_US