HomeLanguagesJavaSignStyle values() method in Java with Examples

SignStyle values() method in Java with Examples

The values() method of SignStyle enum is used to an array containing the units of this SignStyle, in the order, they are declared.

Syntax:

public static SignStyle[] values()

Parameters: This method accepts nothing.

Return value: This method returns an array containing the constants of this enum type, in the order, they are declared.

Below programs illustrate the SignStyle.values() method:
Program 1:




// Java program to demonstrate
// SignStyle.values() method
  
import java.time.format.SignStyle;
  
public class GFG {
    public static void main(String[] args)
    {
  
        // Get SignStyle instance
        SignStyle signStyle
            = SignStyle.valueOf("NEVER");
  
        // Get the contants using values()
        SignStyle[] array
            = signStyle.values();
  
        // Print the values
        for (int i = 0; i < array.length; i++)
            System.out.println(array[i]);
    }
}


Program 2:




// Java program to demonstrate
// SignStyle.values() method
  
import java.time.format.SignStyle;
  
public class GFG {
    public static void main(String[] args)
    {
  
        // Get SignStyle instance
        SignStyle signStyle
            = SignStyle.valueOf("NEVER");
  
        // Get the contants using values()
        SignStyle[] array
            = signStyle.values();
  
        // Print the values
        System.out.println("SignStyle length: "
                           + array.length);
    }
}


References: https://docs.oracle.com/javase/10/docs/api/java/time/format/SignStyle.html

RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32715 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7091 POSTS0 COMMENTS
Nicole Veronica
12230 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12313 POSTS0 COMMENTS
Shaida Kate Naidoo
7208 POSTS0 COMMENTS
Ted Musemwa
7473 POSTS0 COMMENTS
Thapelo Manthata
7192 POSTS0 COMMENTS
Umr Jansen
7173 POSTS0 COMMENTS