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 1Output: Locale: english_IN_IND Variant: IND Example 2Output: Locale1: english_IN_IND Locale2: english_IN_IND Variant of locale1: IND Variant of locale2: WIN Example 3Output: 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 4Output: Locale1: english_IN_IND Name of in Locale: IND Example 5Output: Locale1: english_IN_IND Locale2: french_EC_WIN Name of in Locale1: IND Name of in Locale2: WIN Next TopicJava-locale-getiso3country-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