InterviewSolution
Saved Bookmarks
| 1. |
What is the Locale Class in Java |
|
Answer» A Locale Class is used to perform locale operations and supply locale information to the client or user. Locale is defined as a set of parameters that represents a geographical location or place where some operation occurs. The locale class is declared as follows: public final class Locale extends Object implements Cloneable, SerializableThe Locale class uses the following constructors:
The following program is an example for the implementation of the locale class: import java.text.SimpleDateFormat; import java.util.Locale; public class Example { public static void main(String[] args) { Locale arr[] = SimpleDateFormat.getAvailableLocales(); for (int i = 1; i <=15; i++) { System.out.printf("\N%s (%s) " ,arr[i].getDisplayName(), arr[i].toString()); } } }The output of the following is as follows javac Example.java $java Example Arabic (United Arab Emirates) (ar_AE) Arabic (Jordan) (ar_JO) Arabic (Syria) (ar_SY) Croatian (Croatia) (hr_HR) French (BELGIUM) (fr_BE) Spanish (Panama) (es_PA) Maltese (Malta) (mt_MT) Spanish (Venezuela) (es_VE) Bulgarian (bg) Chinese (Taiwan) (zh_TW) Italian (it) Korean (ko) UKRAINIAN (uk) Latvian (LV) Danish (Denmark) (da_DK) |
|