博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java语言环境getCountry()方法与示例
阅读量:2528 次
发布时间:2019-05-11

本文共 1556 字,大约阅读时间需要 5 分钟。

区域设置类getCountry()方法 (Locale Class getCountry() method)

  • getCountry() method is available in java.util package.

    getCountry()方法在java.util包中可用。

  • getCountry() method is used to get the country code for this Locale and the code may like the empty string "", or two-letter code (ISO 3166).

    getCountry()方法用于获取此语言环境的国家/地区代码,并且该代码可能类似于空字符串“”或两个字母的代码(ISO 3166)。

  • getCountry() method is a non-static method, it is accessible with the class object and if we try to access the method with the class name then we will get an error.

    getCountry()方法是一个非静态方法,可通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • getCountry() method does not throw an exception at the time of returning country code.

    返回国家代码时, getCountry()方法不会引发异常。

Syntax:

句法:

public String getCountry();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of the method is String, it returns country code of this Locale.

方法的返回类型为String ,它返回此Locale的国家/地区代码。

Example:

例:

// Java program to demonstrate the example // of String getCountry() method of Locale import java.util.*;public class GetCountryOfLocale {
public static void main(String[] args) {
Locale lo = new Locale("JAPANESE", "JAPAN"); // Display Locale System.out.println("lo: " + lo); // By using getCountry() method is // to return the country code for this // locale lo String lo_country = lo.getCountry(); // Display Locale Country System.out.println("lo.getCountry(): " + lo_country); }}

Output

输出量

lo: japanese_JAPANlo.getCountry(): JAPAN

翻译自:

转载地址:http://bivzd.baihongyu.com/

你可能感兴趣的文章
组合模式Composite
查看>>
程序员最想得到的十大证件,你最想得到哪个?
查看>>
我的第一篇CBBLOGS博客
查看>>
【MyBean调试笔记】接口的使用和清理
查看>>
07 js自定义函数
查看>>
jQueru中数据交换格式XML和JSON对比
查看>>
form表单序列化后的数据转json对象
查看>>
[PYTHON]一个简单的单元測试框架
查看>>
iOS开发网络篇—XML数据的解析
查看>>
[BZOJ4303]数列
查看>>
数据库TCPIP协议开了,但还是远程连不上
查看>>
一般处理程序在VS2012中打开问题
查看>>
C语言中的++和--
查看>>
thinkphp3.2.3入口文件详解
查看>>
POJ 1141 Brackets Sequence
查看>>
Ubuntu 18.04 root 使用ssh密钥远程登陆
查看>>
linux 单机跨进程通信
查看>>
Servlet和JSP的异同。
查看>>
虚拟机centOs Linux与Windows之间的文件传输
查看>>
ethereum(以太坊)(二)--合约中属性和行为的访问权限
查看>>