uselocale

扫描器类useLocale()方法 (Scanner Class useLocale() method)

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

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

  • useLocale() method is used to use this Scanner locale to the given locale (lo).

    useLocale()方法用于将此Scanner区域设置用于给定的区域设置(lo)。

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

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

  • useLocale() method does not throw an exception at the time of assigning locale.

    useLocale()方法在分配语言环境时不会引发异常。

Syntax:

句法:

    public Scanner useLocale(Locale lo);

Parameter(s):

参数:

  • Locale lo – represents the locale to assign this Scanner.

    语言环境lo –表示要分配此扫描程序的语言环境。

Return value:

返回值:

The return type of the method is Scanner, it returns an object of "Scanner" type.

该方法的返回类型为Scanner ,它返回“ Scanner”类型的对象。

Example:

例:

// Java program to demonstrate the example
// of Scanner useLocale(Locale lo) method of Scanner
import java.util.*;
public class UseLocaleOfScanner {public static void main(String[] args) {String str = "Hi, true IncludeHelp! 8 + 2.0f = 10.0f";
// Instantiate Scanner with the
// given str
Scanner sc = new Scanner(str);
// Display Scanner
System.out.println("sc.nextLine(): " + sc.nextLine());
// By using useLocale() method is to return
// the locale for this Scanner
sc.useLocale(Locale.UK);
// By using locale() method is to print
// the locale of this Scanner
System.out.println("sc.locale(): " + sc.locale());
// close the scanner
sc.close();
}
}

Output

输出量

sc.nextLine(): Hi, true IncludeHelp! 8 + 2.0f = 10.0f
sc.locale(): en_GB

翻译自: https://www.includehelp.com/java/scanner-uselocale-method-with-example.aspx

uselocale

uselocale_Java扫描仪useLocale()方法与示例相关推荐

  1. Java图片扫描仪_Java扫描仪useDelimiter()方法及示例

    扫描仪类useDelimiter()方法 语法:public Scanner skip(Pattern patt); public Scanner skip(String patt);useDelim ...

  2. java中扫描仪程序_Java扫描仪delimiter()方法及示例

    扫描仪类delimiter()方法delimiter()方法在java.util包中可用. delimiter()方法用于检索当前与分隔符匹配的Scanner的模式. delimiter()方法是一种 ...

  3. .net连接mysql数据_.net连接MYSQL数据库的方法及示例!

    连接MYSQL数据库的方法及示例 方法一: 使用MYSQL推出的MySQL Connector/Net is an ADO.NET driver for MySQL 该组件为MYSQL为ADO.NET ...

  4. set.difference() 的用法(python3)_Python 集合 difference_update() 使用方法及示例

    Python 集合 difference_update() 使用方法及示例 Difference_update()使用集合的差集更新集合,并调用difference_update()方法. 如果A和B ...

  5. doc python 颜色_Python wordcloud.ImageColorGenerator方法代码示例

    本文整理汇总了Python中wordcloud.ImageColorGenerator方法的典型用法代码示例.如果您正苦于以下问题:Python wordcloud.ImageColorGenerat ...

  6. isdigit函数在C语言什么意思,C 库函数 isdigit() 使用方法及示例

    C 库函数 isdigit() 使用方法及示例 isdigit()函数检查字符是否为数字字符(0-9). isdigit()的函数原型int isdigit( int arg ); 函数isdigit ...

  7. python中append的用法_Python 列表 append() 使用方法及示例

    Python 列表 append() 使用方法及示例 append()方法将一个项目添加到列表的末尾. append()方法将单个项目添加到列表的末尾. append()方法的语法为:list.app ...

  8. java kryo_Kryo框架使用方法代码示例

    Kryo框架的source已移至https://github.com/EsotericSoftware/kryo ,进入此页面,然后点击右边的Download Zip按钮,就能下载到最新版本的Kryo ...

  9. python文件的用法,Python 文件 readlines() 使用方法及示例

    Python 文件 readlines() 使用方法及示例 概述 readlines() 方法用于读取所有行(直到结束符 EOF)并返回列表,该列表可以由 Python 的 for... in ... ...

最新文章

  1. 《CDN 之我见》系列二:原理篇(缓存、安全)
  2. CMD中使用attrib命令设置文件只读、隐藏属性详解
  3. is_valid校验机制
  4. GUI编程与CLI编程
  5. PHP中的加强型接口Traits
  6. Qt的QStyle类的标准图标汇总
  7. IIS Web 服务器/ASP.NET 运行原理基本知识概念整理
  8. SpringCloud实战小贴士:Zuul的路径匹配
  9. C++ 虚函数和虚继承解析
  10. Leetcode每日一题:83.remove-duplicates-from-sorted-list(删除排序链表中的重复元素)
  11. 一文搞懂 Spring JPA
  12. DE9 二阶常系数线性方程
  13. JavaScript 自定义年月日选择下拉框select选择的日期方法vue实现
  14. 人工智能影响学习的5种方式
  15. 基于图灵api的Python机器人
  16. [poj2449]Remmarguts' Date(spfa+A*)
  17. linux共用home分区,安装UOS和Deepin双系统并且共用/home分区的测试报告
  18. Vercel部署个人博客
  19. 这种 Unicode 符号,让百万人中招下了假应用…
  20. 计算机 手机原理是什么,什么是手机投屏,手机投屏到电脑上的原理

热门文章

  1. lan交换和无线教师手册_简单几步,无线路由器变交换机
  2. Docker教程介绍
  3. Facebook 游戏开发更新文档 API 参考文档 v6.0
  4. 开源Registry项目Harbor源代码结构解析
  5. C#对config配置文件的管理
  6. Android Bundle类别
  7. Flex Graphics
  8. discusz 判断当前页是门户还是论坛
  9. 物联网碰到云计算会怎么样?
  10. 远程服务器电脑的设置