FormatStyle valueOf() method in Java with Examples Last Updated : 04 Feb, 2020 Comments Improve Suggest changes Like Article Like Report The valueOf() method of a FormatStyle enum is used to get the enum value of this type FormatStyle with the specified name. Syntax: public static FormatStyle valueOf(String name) Parameters: This method accepts a name as the parameter which is the name of the enum constant to be returned. Return value: This method returns the enum constant with the specified name. Exceptions: This method throws the following exception: IllegalArgumentException: if this enum type has no constant with the specified name. NullPointerException: if the argument is null. Below programs illustrate the FormatStyle.valueOf() method: Program 1: Java // Java program to demonstrate // FormatStyle.valueOf() method import java.time.format.FormatStyle; public class GFG { public static void main(String[] args) { // Get FormatStyle instance FormatStyle formatStyle = FormatStyle.valueOf("LONG"); // Print the result System.out.println("FormatStyle: " + formatStyle); } } Output: FormatStyle: LONG Program 2: Java // Java program to demonstrate // FormatStyle.valueOf() method import java.time.format.FormatStyle; public class GFG { public static void main(String[] args) { // Get FormatStyle instance FormatStyle formatStyle = FormatStyle.valueOf("FULL"); // Print the result System.out.println("FormatStyle: " + formatStyle); } } Output: FormatStyle: FULL References: https://docs.oracle.com/javase/10/docs/api/java/time/format/FormatStyle.html Comment More infoAdvertise with us Next Article FormatStyle valueOf() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java.time.format package Java-FormatStyle Practice Tags : Java Similar Reads FormatStyle values() method in Java with Examples The values() method of FormatStyle enum is used to an array containing the units of this FormatStyle, in the order, they are declared.Syntax: public static FormatStyle[] values() Parameters: This method accepts nothing.Return value: This method returns an array containing the constants of this enum 1 min read Float shortValue() method in Java with examples The shortValue() method in Float Class is a built-in method in Java which returns the value specified by calling the object as short after typecasting.Syntax: public short shortValue() Return Value: It return the value of FloatObject as short.Below programs illustrate shortValue() method in Java: Pr 2 min read Number.floatValue() method in java with examples The floatValue() method is an inbuilt method in Java from the java.lang.Number class. This method is used when we want to extract the value of a Number object as a float data type. This may involve rounding or truncation, because this method returns the numeric value of the current object converted 2 min read Float parseFloat() method in Java with examples The parseFloat() method in Float Class is a built in method in Java that returns a new float initialized to the value represented by the specified String, as done by the valueOf method of class Float. Syntax: public static float parseFloat(String s) Parameters: It accepts a single mandatory paramete 2 min read Short floatValue() method in Java with Example The java.lang.Short.floatValue() method of Short class is a built in method in Java which is used to return the value of the Short object as a float. Syntax: public float floatValue() Return type: It return the value of ShortObject as float. Below is the implementation of floatValue() method in Java 2 min read Like