📌  相关文章
📜  Java.util.Locale类

📅  最后修改于: 2020-11-14 06:20:02             🧑  作者: Mango


介绍

java.util.Locale类对象表示特定的地理,政治或文化区域。以下是关于语言环境的重点-

  • 需要语言环境执行其任务的操作称为对语言环境敏感的操作,并使用该语言环境为用户形成信息。

  • 语言环境是一种用于标识对象的机制,而不是对象本身的容器。

类声明

以下是java.util.Locale类的声明-

public final class Locale
   extends Object
   implements Cloneable, Serializable

领域

以下是java.util.Locale类的字段-

  • 静态语言环境加拿大-这是国家的常量。

  • 静态语言环境加拿大法语-这是国家/地区的常数。

  • 静态语言环境中国-这是国家的常数。

  • 静态语言环境中文-这是语言的常量。

  • 静态语言环境英语-这是语言的常量。

  • 静态语言环境法国-这是国家的常数。

  • 静态语言环境FRENCH-这是语言的常量。

  • 静态语言环境GERMAN-这是语言的常数。

  • 静态语言环境德国-这是国家的常量。

  • 静态语言环境ITALIAN-这是语言的常量。

  • 静态语言环境意大利-这是国家的常量。

  • 静态语言环境JAPAN-这是国家/地区的常量。

  • 静态语言环境JAPANESE-这是语言的常量。

  • static Locale KOREA-这是国家/地区的常数。

  • 静态语言环境KOREAN-这是语言的常数。

  • 静态Locale PRC-这是国家的常量。

  • 静态区域设置根-这是根区域设置的常量。

  • 静态语言环境简体中文-这是语言的常量。

  • 静态语言环境台湾-这是国家/地区的常数。

  • 静态语言环境繁体中文-这是语言的常量。

  • static Locale UK-这是国家/地区的常量。

  • static Locale US-这是国家/地区的常量。

类的构造函数

Sr.No. Constructor & Description
1

Locale(String language)

This constructs a locale from a language code.

2

Locale(String language, String country)

This constructs a locale from a language code.

3

Locale(String language, String country, String variant)

This constructs a locale from language, country, variant.

类方法

Sr.No. Method & Description
1 Object clone()

This method overrides Cloneable

2 boolean equals(Object obj)

This method returns true if this Locale is equal to another object.

3 static Locale[] getAvailableLocales()

This method returns an array of all installed locales.

4 String getCountry()

This method returns the country/region code for this locale, which will either be the empty string or an uppercase ISO 3166 2-letter code.

5 static Locale getDefault()

This method gets the current value of the default locale for this instance of the Java Virtual Machine.

6 String getDisplayCountry()

This method returns a name for the locale’s country that is appropriate for display to the user.

7 S String getDisplayCountry(Locale inLocale)

This method Returns a name for the locale’s country that is appropriate for display to the user.

8 String getDisplayLanguage()

This method returns a name for the locale’s language that is appropriate for display to the user.

9 String getDisplayLanguage(Locale inLocale)

This method returns a name for the locale’s language that is appropriate for display to the user.

10 String getDisplayName()

This method returns a name for the locale that is appropriate for display to the user.

11 String getDisplayName(Locale inLocale)

This method returns a name for the locale that is appropriate for display to the user.

12 String getDisplayVariant()

This method returns a name for the locale’s variant code that is appropriate for display to the user.

13 String getDisplayVariant(Locale inLocale)

This method returns a name for the locale’s variant code that is appropriate for display to the user.

14 String getISO3Country()

This method returns a three-letter abbreviation for this locale’s country.

15 String getISO3Language()

This method returns returns a three-letter abbreviation for this locale’s language.

16 static String[] getISOCountries()

This method returns a list of all 2-letter country codes defined in ISO 3166.

17 static String[] getISOLanguages()

This method returns a list of all 2-letter language codes defined in ISO 639.

18 String getLanguage()

This method returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.

19 String getVariant()

This method returns the variant code for this locale.

20 int hashCode()

This method override hashCode.

21 static void setDefault(Locale newLocale)

This method sets the default locale for this instance of the Java Virtual Machine.

22 String toString()

This method is the getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars.

方法继承

此类从以下类继承方法-

  • java.util.Object