Calendar getAvailableLocales() Method in Java with Examples
The clear() method in Calendar class is used to return an array of all the locales available at the localized instances of the getInstance method of this class.
Syntax:
public static Locale[] getAvailableLocales()
Parameters: The method does not take any parameters.
Return Value: The method returns an array of all the locales for which the localized instances are available.
Below programs illustrate the working of getAvailableLocales() Method of Calendar class:
Example 1:
// Java Code to illustrate // getAvailableLocales() Method import java.util.*; public class Calendar_Demo_Locale { public static void main(String args[]) { // Creating a locale object Locale loc_arr[] = new Locale[5]; // Assigning locales to array loc_arr = Locale.getAvailableLocales(); // Displaying the results System.out.println("The first " + "five locales are:"); for (int cnt = 0; cnt < 5; cnt++) System.out.println( loc_arr[cnt] .getISO3Country()); } } |
The first five locales are: ARE JOR SYR HRV
Example 2:
// Java Code to illustrate // getAvailableLocales() Method import java.util.*; public class Calendar_Demo_Locale { public static void main(String args[]) { // Creating a locale object Locale loc_arr[] = new Locale[20]; // Assigning locales to array loc_arr = Locale.getAvailableLocales(); // Displaying the results System.out.println("The first " + "twenty availables" + " locales are:"); for (int cnt = 0; cnt < 20; cnt++) System.out.println( loc_arr[cnt] .getISO3Country()); } } |
The first twenty availables locales are: ARE JOR SYR HRV BEL PAN MLT VEN TWN DNK PRI VNM USA MNE
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#clone()
Recommended Posts:
- DateFormatSymbols getAvailableLocales() Method in Java with Examples
- NumberFormat getAvailableLocales() method in Java with Examples
- DecimalFormatSymbols getAvailableLocales() method in Java with Examples
- DateFormat getAvailableLocales() Method in Java with Examples
- Locale getAvailableLocales() Method in Java with Examples
- BreakIterator getAvailableLocales() method in Java with Examples
- Calendar add() Method in Java with Examples
- Calendar set() Method in Java with Examples
- Calendar get() method in Java with Examples
- Calendar toString() Method in Java with Examples
- Calendar compareTo() Method in Java with Examples
- Calendar getInstance() Method in Java with Examples
- Calendar getLeastMaximum() method in Java with Examples
- Calendar getTimeInMillis() Method in Java with Examples
- Calendar getMaximum() method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


