Java Programing laungage

java.util Projects

java.util Project 1

Setting the default Locale

In This program shows that how we can set the default locale. In the given Example described the code, how to get and set the default locale.

Previous Home Next
API of program


This method is used to return the default locale in installed all locales.


This method is used to set the locale for the default setting. SetDefault() method takes a locale as a parameter for the method to set it as a default locale.


package r4r;
import java.util.*;
public class defaultlocatetest {
public static void main(String[]args)
Locale loc = Locale.getDefault();
  System.out.println(loc.getDisplayName() + loc.getCountry());
  loc = Locale.getDefault();
  System.out.println("For Default Locale : " + loc.getLanguage());


English (United States)US
For Default Locale : en

Previous Home Next