Java Locale hashCode() method7 Nov 2024 | 1 min read The hashCode() method of Java Locale class returns a hash code for this locale. This method overrides the hashCode. SyntaxReturnIt returns a hash code value for this locale. Example 1Output: Locale: java_T_point HashCode for this locale: -1713116582 Example 2Output: Locale1: java_T_point HashCode for locale1: -1713116582 Locale1: java_T_point HashCode for locale1: -1713116582 Next TopicJava-locale-setdefault-method |
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 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 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 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
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 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 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 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 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 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