/*This section shows you how to set the default locale. Example presented in the section, illustrates you how to get and set the default locale.
Following API has been used in the program:
Locale.getDefault():
Above method returns the default locale in installed all locales.
Locale.setDefault():
Above method sets the locale for the default setting. This method takes a locale as a parameter for the method to set it as a default locale.
*/
import java.util.*;
public class DefaultLocale{
public static void main(String[] args){
Locale locale = Locale.getDefault();
System.out.println(locale.getDisplayName() + locale.getCountry());
Locale.setDefault(Locale.ENGLISH);
locale = Locale.getDefault();
System.out.println("For Default Locale : " + locale.getLanguage());
}
}
No comments:
Post a Comment