getDisplayLanguage(): This method is available in java.util.Locale class of Java.
Syntax:
String java.util.Locale.getDisplayLanguage()
This method returns a name for the locale's language that is appropriate for display to the user. If the locale doesn't specify a language, this function returns the empty string.
Returns: The name of the display language.
For Example:
Locale locale = new Locale("en", "USA")
locale.getDisplayLanguage() = > It returns English.
Approach
Java
import java.util.Locale;public class LocalegetDisplayLanguage {public static void main(String[] args) {Locale locale = new Locale("en", "USA");System.out.println(locale.getDisplayLanguage());}}
Output:
English
No comments:
Post a Comment