Month getDisplayName() method in Java
The getDisplayName() method is a built-in method of the Month ENUM which is used to get the textual representation of the month-of-year specified by this Month instance.
public String getDisplayName(TextStyle style, Locale locale)
Parameters: This method accepts two parameters as described below:
- style: This parameter specifies the style or the length of the text to be use, i.e., short, long etc.
- locale: This parameter specified the locale to be used.
Return Value: This method returns the textual representation of the month specified by this Month instance.
Below programs illustrate the above method:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.