Java Locale getVariant() method7 Nov 2024 | 1 min read The getVaiant() method of Java Locale class is used to return the variant code for this locale. SyntaxParameterNA ReturnThis method returns the variant code. If none is defined, this method will return an empty string. Example 1Output: Locale: english_IN_IND Variant name: IND Example 2Output: Locale1: english_IN_IND Locale2: english_IN_IND Variant of locale1: IND Variant of locale2: WIN Next TopicJava-locale-hashcode-method |
The toString() method of Locale class is used to return a string representation of this Locale object, consisting of language, country, variant, script, and extensions. Syntax public final String toString() Parameter NA Return This method returns a string representation of the Locale, for debugging. Example 1 import java.util.*; public class LocaleToStringExample1 { public...
2 min read
The getLanguage() method of Java Locale class is used to return the language code of this Locale. Syntax public String getLanguage() Parameter NA Return This method returns the language code or the empty string if none is defined. Example 1 import java.util.*; public class LocaleGetLanguageExample1 { public static void main(String[] args) { ...
1 min read
The getISO3Country() method of Java Locale class returns a three-letter abbreviation for this locale's country. If the locale doesn't specify a county, this method will return an empty string. Otherwise, this method will return an uppercase ISO 3166 3-letter country code. Syntax public String getISO3Country() Parameter NA Return This method returns a...
2 min read
The getAvailableLocales() method of Java Locale class is used to return an array of all installed locales. The returned array represents the union of locales which is supported by installed LocaleServiceProvider implementations and by the Java runtime environment. Syntax public static Locale[] getAvailableLocales() Parameter NA Return This method returns an array...
1 min read
The getDisplayLanguage(Locale inLocale) method of Java Locale class returns a name for the locale's language that is appropriate for display to the user. If possible, the name returned will be localized according to inLocale. Syntax public String getDisplayLanguage(Locale inLocale) Parameter NA Return This method does not return a value. Example 1 import java.util.*; public...
2 min read
The getDefault() method of Java Locale class is used to get the current value of the default locale for this instance of the JVM(Java Virtual Mchine). Syntax public static Locale getDefault() Return It returns the default locale for this instance of the Java Virtual Machine Example 1 import java.util.*; public class LocaleGetDefaultExample1...
1 min read
The setDefault() method of Java Locale class is used to set the default locale for this instance of the JVM(Java Virtual Machine). It does not affect the host locale. Syntax public static void setDefault(Locale newLocale) Parameter newLocale: It is the new default locale. Return NA Exceptions SecurityException: This exception will throw if a security...
2 min read
The 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. Syntax public final String getDisplayName() Parameter NA Return This method does...
3 min read
The getISOLanguages() method of Locale class returns a list of all 2-letter language codes defined in ISO 639. This method can be used to create Locales. Syntax public static String[] getISOLanguages() Parameter NA Return Value This method doesn't return any value. Example 1 import java.util.*; public class LocaleGetISOLanguagesExample1 { public static void main(String[]...
2 min read
The 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. Syntax public final String getDisplayVariant() Parameter NA Example 1 import java.util.*; public class...
3 min read
We request you to subscribe our newsletter for upcoming updates.
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