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



