Java.util.Calendar.getAvailableLocales() Method


Advertisements


Description

The java.util.Calendar.getAvailableLocales() method returns an array of locales for which the getInstance methods of this class can return localized instances.

Declaration

Following is the declaration for java.util.Calendar.getAvailableLocales() method

public static Locale[] getAvailableLocales()

Parameters

NA

Return Value

Returns an array of locales for which localized Calendar instances are available.

Exception

NA

Example

The following example shows the usage of java.util.calendar.getAvailableLocales() method.

Live Demo
package com.tutorialspoint;

import java.util.*;

public class CalendarGetAvailableLocalesEx {
   public static void main(String args[]) {

      // create an object of locale class 
      Locale[] array = new Locale[10];

      // get available locales and assign them to array
      array = Locale.getAvailableLocales();

      // print the results
      System.out.println("The first 10 locales installed are :-\n");
      for (int i = 0; i < 10; i++) {
         System.out.println(array[i].getISO3Country());
      }
   }
}

Let us compile and run the above program, this will produce the following result −

The first 10 locales installed are :-

ARE
JOR
SYR
HRV
BEL
PAN
MLT
VEN

java_util_calendar.htm

Advertisements
E-Books Store