The getDisplayName() method of the ZoneId class used to get the textual representation of the zone suitable for presentation to the user such as ‘British Time’ or ‘+02:00’.If no textual mapping is found then the full ID is returned.
public String getDisplayName(TextStyle style, Locale locale)
Parameters: This method accepts two parameters style and locale where style represents the length of the text required and locale represents the locale to use.
Return value: This method returns the text value of the zone.
Below programs illustrate the getDisplayName() 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.