新彩天欢迎您!
幻海优品

Java.util.Locale类

简介

java.util.Locale 类对象代表特定的地理,政治或文化区域.以下是关于Locale&minus的重要观点;

  • 需要Locale执行其任务的操作称为locale-敏感并使用Locale为用户形成信息.

  • Locale是一种识别对象的机制,而不是对象本身的容器.

类声明

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

public final class Locale   extends Object   implements Cloneable, Serializable

字段

以下是 java.util.Locale class :

  • static Locale CANADA: 这是国家的常数.

  • static Locale CANADA FRENCH :这是国家的常数.

  • static Locale CHINA :这是国家的常数.

  • static Locale CHINESE :这是语言的常量.

  • static Locale ENGLISH :这是语言的常量.

  • static Locale FRANCE :这是国家的常数.

  • static Locale FRENCH : 这是语言的常量.

  • static Locale GERMAN :这是语言的常量.

  • static Locale GERMANY:这是国家的常数.

  • static Locale ITALIAN :这是语言的常量.

  • static Locale ITALY :这是国家的常数.

  • static Locale JAPAN:这是国家的常数.

  • static Locale JAPANESE :这是语言的常量.

  • static Locale KOREA :这是国家的常数.

  • static Locale KOREAN:这是语言的常量.

  • static Locale PRC:这是国家的常数.

  • static Locale ROOT : 这是根区域设置的常量.

  • static Locale SIMPLIFIED CHINESE: 这是语言的常量.

  • static Locale TAIWAN :这是国家的常数.

  • static Locale TRADITIONAL CHINESE :这是语言的常量.

  • static Locale UK :这是国家的常数.

  • static Locale US :这是国家的常数.

类构造函数

Sr.No.Constructor & Description
1

Locale(String language)

这从语言代码构造语言环境.

2

Locale(String language, String country)

这从语言代码构造语言环境.

3

Locale(String language, String country, String variant)

这构建了语言,国家,变体的语言环境.

Class methods

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

This method overrides Cloneable

2boolean equals(Object obj)

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

3static Locale[] getAvailableLocales()

This method returns an array of all installed locales.

4String 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.

5static Locale getDefault()

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

6String getDisplayCountry()

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

7S String getDisplayCountry(Locale inLocale)

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

8String getDisplayLanguage()

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

9String getDisplayLanguage(Locale inLocale)

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

10String getDisplayName()

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

11String getDisplayName(Locale inLocale)

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

12String getDisplayVariant()

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

13String getDisplayVariant(Locale inLocale)

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

14String getISO3Country()

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

15String getISO3Language()

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

16static String[] getISOCountries()

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

17static String[] getISOLanguages()

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

18String getLanguage()

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

19String getVariant()

This method returns the variant code for this locale.

20int hashCode()

This method override hashCode.

21static void setDefault(Locale newLocale)

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

22String toString()

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

Methods inherited

This class inherits methods from the following classes −

  • java.util.Object


免责声明:以上内容(如有图片或视频亦包括在内)有转载其他网站资源,如有侵权请联系删除