Home Java Java-get-example Java get default Locale



Java get default Locale
Posted on: October 24, 2008 at 12:00 AM
Locale object is a representation of geographical, political, or cultural region. We can get and set our default locale through the java programs. For setting or getting default Locale we need to call static method getDefault() of Locale.

Java get default Locale

     

Locale object is a representation of geographical, political, or cultural region. We can get and set our default locale through the java programs. For setting or getting default Locale we need to call static method getDefault() of Locale.

Locale locale = Locale.getDefault();

Above line of code gets the default method now we can print this default locale value. Here is the full example code of GetDefaultLocale.java as follows:

 

 

GetDefaultLocale.java

import java.util.*;

public class GetDefaultLocale{
  public static void main(String[] args){
  Locale locale = Locale.getDefault();
  System.out.println(locale);
  }
}

 

Output:

C:\javaexamples>javac GetDefaultLocale.java

C:\javaexamples>java GetDefaultLocale
en_US

 

Download Source Code

 

Related Tags for Java get default Locale:
javacstaticobjectiomethodgetgraphdefaultlocalesetlocalforcallprogramtoramicalpresentationeregionitrepresentationcanliulfaultincalstamntcajestdthroughalllocmehrobjprogeographicalseeatisllpregraphicandstatreprsettingvattssthavstatiapefaultjeicaicaprndonogrolo


More Tutorials from this section

Ask Questions?    Discuss: Java get default Locale  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.