Java Locale getDisplayVariant() methodThe getDisplayVaiant() method of Java Locale class is used to return a name for the locale's variant code that is appropriate for display to the user. This method returns the empty string if the locale doesn't specify a variant code. SyntaxParameterNA Example 1Test it NowOutput: Locale: english_IN_IND Variant: IND Example 2Test it NowOutput: Locale1: english_IN_IND Locale2: english_IN_IND Variant of locale1: IND Variant of locale2: WIN Example 3Test it NowOutput: Locale1: english_IN Variant of locale1: Java Locale getDisplayVariant() methodThe getDisplayVariant(Locale inLocale) method of Java Locale class is used to return a name for the locale's variant code that is appropriate for display to the user. This method returns the empty string if the locale doesn?t specify a variant code. SyntaxThrowsNullPointerException - This exception will throw if inLocale is null. Example 4Test it NowOutput: Locale1: english_IN_IND Name of in Locale: IND Example 5Test it NowOutput: Locale1: english_IN_IND Locale2: french_EC_WIN Name of in Locale1: IND Name of in Locale2: WIN
Next TopicJava Locale
|