Java Locale getDisplayName() methodThe getDisplayName() method of Locale class is used to return a name for the locale that is appropriate for display to the user. This will be the value returned by getDisplayScript(), getDisplayLanguage(), getDisplayCountry(), and getDisplayVariant() assembled into a single string. SyntaxParameterNA ReturnThis method does not return a value. Example 1Output: Locale: english_IN Name: english (India) Example 2Output: Locale1: english_IN Locale2: german_AU Name of Locale1: english (India) Name of Locale2: german (Australia) Example 3Output: Locale1: spanish_EC Locale2: french_BE Locale3: french_BE Name of Locale1: spanish (Ecuador) Name of Locale2: french (Belgium) Name of Locale3: german (Australia) Java Locale getDisplayName(Locale inLocale) methodThe getDisplayName(Locale inLocale) method of Locale class is used to return a name for the locale that is appropriate for display to the user. This will be the value returned by getDisplayScript(), getDisplayLanguage(), getDisplayCountry(), and getDisplayVariant() assembled into a single string. SyntaxThrowsNullPointerException: This exception will throw if inLocale is null. Example 4Output: Locale: english_IN Name of in Locale: english (India) Example 5Output: Locale1: english_IN Locale2: spanish_EC Name of in Locale1: english (India) Name of in Locale2: spanish (Ecuador) Next TopicJava-locale-getdisplayvariant-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India