Locale.Category values() method in Java with Examples

The values() method of java.util.Locale.Category enum in Java is used to get the values of the constants of this Locale.Category enum type, in the order they are declared. This method returns an array of the constants and hence can also be iterated.


public static Locale.Category[] values()

Parameter: This method do not accept any parameter.

Return Type: This method returns an array of the constants of this Locale.Category enum type.

Exception: This method do not throw any exception.

Program 1:





// Java program to demonstrate
// the above method
import java.util.*;
import java.util.Locale.*;
public class LocaleCategoryDemo {
    public static void main(String[] args)
        // Getting the array of constants
        // of Locale.Category
        System.out.println("Array of constants: "
                           + Arrays.toString(



Array of constants: [DISPLAY, FORMAT]

Reference: https://docs.oracle.com/javase/9/docs/api/java/util/Locale.Category.html#values–

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.