5.3.  Read and set the locale by using the Locale object

[Note]

The four ways to create a Locale object are:

The Java platform does not require you to use the same Locale throughout your program. If you wish, you can assign a different Locale to every locale-sensitive object in your program. This flexibility allows you to develop multilingual applications, which can display information in multiple languages.

However, most applications are not multi-lingual and their locale-sensitive objects rely on the default Locale. Set by the Java Virtual Machine when it starts up, the default Locale corresponds to the locale of the host platform. To determine the default Locale of your Java Virtual Machine, invoke the Locale.getDefault() method:

Locale l = Locale.getDefault();
					

You can set the default locale for all locate-sensitive classes by using the Locale.setDefault(Locale l) method:

Locale.setDefault(new Locale("be", "BY"));
					

NOTE: you should not set the default Locale programmatically because it is shared by all locale-sensitive classes.

Professional hosting         Free 'Oracle Certified Expert Web Services Developer 6' Guide     Free SCDJWS 5.0 Guide