Java Locale setDefault() methodThe setDefault() method of Java Locale class is used to set the default locale for this instance of the JVM(Java Virtual Machine). It does not affect the host locale. SyntaxParameternewLocale: It is the new default locale. ReturnNA ExceptionsSecurityException: This exception will throw if a security manager exists and its checkPermission method doesn't allow the operation. NullPointerException: This exception will throw if newLocale is null. Example 1Output: Locale1: en_US_WIN Example 2Output: Locale1: en_US NEW Default locale2: fr_FRANCE_MAC Locale3: fr_FRANCE_MAC NEW Default locale4: en_US_WIN Next TopicJava-locale-tostring-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India