Java Locale getDefault() Example
Locale class getDefault() method example. This example shows you how to use getDefault() method.
Syntax is : public public static Locale getDefault()
Method returns the current value of the default locale for this instance of the Java Virtual Machine. It can be changed using the setDefault()
method.
Here is the code.
/**
* @(#) GetDefaultLocale.java
* A class representing use of method getDefault() of Locale class
in java.util Package.
* @Version 24-May-2008
* @author Rose India Team
*/
import java.util.*;
class GetDefaultLocale {
public static void main( String args[] ){
// getDefault() method call. This is static method.
Locale locale = Locale.getDefault();
System.out.println("current value of the default locale : " + locale);
}
} |
Output of the program.
| current value of the default locale : en_US |
|