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 1Test it NowOutput: Locale: english_IN Name: english (India) Example 2Test it NowOutput: Locale1: english_IN Locale2: german_AU Name of Locale1: english (India) Name of Locale2: german (Australia) Example 3Test it NowOutput: 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 4Test it NowOutput: Locale: english_IN Name of in Locale: english (India) Example 5Test it NowOutput: Locale1: english_IN Locale2: spanish_EC Name of in Locale1: english (India) Name of in Locale2: spanish (Ecuador)
Next TopicJava Locale
|