Javatpoint Logo
Javatpoint Logo

Java Locale getVariant() method

The getVaiant() method of Java Locale class is used to return the variant code for this locale.

Syntax

Parameter

NA

Return

This method returns the variant code. If none is defined, this method will return an empty string.

Example 1

Test it Now

Output:

Locale: english_IN_IND
Variant name: IND

Example 2

Test it Now

Output:

Locale1: english_IN_IND
Locale2: english_IN_IND
Variant of locale1: IND
Variant of locale2: WIN
Next TopicJava Locale




Help Others, Please Share

facebook twitter pinterest