SignStyle values() method in Java with Examples
Last Updated :
04 Feb, 2020
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:
import java.time.format.SignStyle;
public class GFG {
public static void main(String[] args)
{
SignStyle signStyle
= SignStyle.valueOf( "NEVER" );
SignStyle[] array
= signStyle.values();
for ( int i = 0 ; i < array.length; i++)
System.out.println(array[i]);
}
}
|
Program 2:
import java.time.format.SignStyle;
public class GFG {
public static void main(String[] args)
{
SignStyle signStyle
= SignStyle.valueOf( "NEVER" );
SignStyle[] array
= signStyle.values();
System.out.println( "SignStyle length: "
+ array.length);
}
}
|
References: https://docs.oracle.com/javase/10/docs/api/java/time/format/SignStyle.html
Share your thoughts in the comments
Please Login to comment...