Open In App

SignStyle values() method in Java with Examples

Last Updated : 04 Feb, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads