Java Locale getLanguage() method7 Nov 2024 | 1 min read The getLanguage() method of Java Locale class is used to return the language code of this Locale. SyntaxParameterNA ReturnThis method returns the language code or the empty string if none is defined. Example 1Output: Locale: fr_CANADA Language: fr Example 2Output: Locale1: fr_CANADA Locale2: en_US Language1: fr Language2: en Next TopicJava-locale-getvariant-method |
The getCountry() method of Java Locale class returns the country/region code for this locale. This code can either be the empty string, an uppercase ISO 3166 2-letter code. If none is defined, this method will return the empty string. Syntax public String getCountry() Parameter NA Return The getCountry() method returns the...
2 min read
The getDisplayCountry() method of Java Locale class returns a name for the locale's country that is appropriate for display to the user. Syntax public final String getDisplayCountry() Parameter NA Return It does not return any value. Example 1 import java.util.*; public class LocaleGetDisplayCountryExample1 { public static void main(String[] args) { // Creating a new Locale ...
3 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 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 hashCode() method of Java Locale class returns a hash code for this locale. This method overrides the hashCode. Syntax public int hashCode() Return It returns a hash code value for this locale. Example 1 import java.util.*; public class LocaleHashCodeExample1 { public static void main(String[] args) { // create a new locale ...
1 min read
The equals() method of Java Locale class returns true if this Locale is equal to another object. A Locale is deemed equal to another Locale with identical language, variant, country, extension, script, and unequal to all other objects. Syntax public boolean equals(Object obj) Parameter obj: It is the reference...
3 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 getISOCountries() method of Locale class returns a list of all 2-letter country codes defined in ISO 639. This method can be used to create Locales. Syntax public static String[] getISOCountries() Parameter NA Return Value This method doesn't return any value. Example 1 import java.util.*; public class LocaleGetISOCountriesExample1 { public static...
2 min read
The getISO3Language() method of Java Locale class returns a three-letter abbreviation for this locale's language. If the locale doesn't specify a language, this method will return an empty string. Otherwise, this method will return an uppercase ISO 3166 3-letter language code. Syntax public String getISO3Language() Parameter NA Return value This method returns...
2 min read
The object represents a specific geographic, cultural, or political region. It is a mechanism to for identifying objects, not a container for the objects themselves. A Locale object logically consists of the fields like languages, script, country, variant, extensions. Syntax public final class Locale extends...
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