Java Formatter locale()方法与示例

Formatter类的locale()方法 (Formatter Class locale() method)

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

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

  • locale() method is used to returns the locales assign by the construction of this Formatter.

    locale()方法用于返回通过此Formatter的构造分配的语言环境。

  • locale() 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.

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

  • locale() method may throw an exception at the time of returning Locale object.

    返回Locale对象时, locale()方法可能会引发异常。

    FormatterClosedException: This exception may throw when this Formatter close by calling it's close().

    FormatterClosedException:当此Formatter通过调用close()关闭时,可能会引发此异常。

Syntax:

句法:

    public Locale locale();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of this method is Locale, it returns locale of this formatter otherwise it returns null.

此方法的返回类型为Locale ,它返回此格式化程序的语言环境,否则返回null。

Example:

例:

// Java program is to demonstrate the example of
// locale() method of Formatter
import java.util.*;
public class LocaleOfFormatter {
public static void main(String[] args) {
// Instantiates a StringBuffer and Formmatter object
StringBuffer sb = new StringBuffer();
Formatter formatt = new Formatter(sb, Locale.UK);
// By using format() method is to format a string
formatt.format("Hi %s !", "IncludeHelp");
// Display Formatted String
System.out.println(formatt);
// By using locale() method is to
// return the locale set by the formation
// of this Formattr
System.out.println("formatt.locale(): " + formatt.locale());
}
}

Output

输出量

Hi IncludeHelp !
formatt.locale(): en_GB

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/541245.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

cad中tk什么意思_设计中的“Neobject”什么意思?来了解一下

DesignArchitectureInteriorsFashionArtTransportTHE STUFF THAT REFINES YOU破界造物New Language?“Neobject,言如其字,从语义上,前缀 neo- 表示新的,object 则是物体,是客观存在,很中性,作动…

html文段源码,HTML 段落

HTML 段落HTML 可以将文档分割为若干段落。HTML 段落段落是通过 标签定义的。实例这是一个段落这是另一个段落尝试一下 注意:浏览器会自动地在段落的前后添加空行。( 是块级元素)不要忘记结束标签即使忘了使用结束标签,大多数浏览器也会正确地将 HTML 显…

Python基础语法学习整理

1、基础 r’ ‘:原始字符串 pow、round是内建函数 2、序列通用操作: 索引:d[] 分片:[:] 相加:d[] 乘法:[1,2]*3 成员判断:in 可用函数:len max min 3、列表 删除:del …

Java Collections copy()方法与示例

集合类的copy()方法 (Collections Class copy() method) copy() method is available in java.util package. copy()方法在java.util包中可用。 copy() method is used to copy all the elements from List the src_list (source list) and place all the copied elements into…

c#如何实现叫号操作_微信预约排队叫号系统操作指南

“微信排队预约"功能是阿拉善盟税务局为进一步优化营商环境,深化“放管服”改革,提高纳税便利度,更好地服务于阿拉善经济社会发展而开发的一项便民措施。通过“微信排队预约”功能,纳税人可以随时随地通过微信获取办税大厅的…

计算机用户越权操作的原因,“三员系统”中常见的越权问题

原标题:“三员系统”中常见的越权问题一、越权访问越权访问(Broken Access Control,简称BAC)是Web应用程序中一种常见的漏洞,由于其存在范围广、危害大,被OWASP列为Web应用十大安全隐患的第二名。1.1越权访问的产生比如&#xff0…

富士施乐2022网络扫描设置_富士施乐(FUJI XEROX)全系列复印机产品介绍

富士施乐(FUJI XEROX)复印机全系列详解富士施乐复印机是中小型办公环境的理想机型。所有的都拥有高效生产力和强大的稳定性,无论您需要亮丽色彩、黑白打印、亦或是足以应对复杂文档工作流的强大功能,总有一款适合您。DocuCentre S2110NDocuCentre S2110N…

ruby hash方法_Ruby中带有示例的Hash.rassoc(obj)方法

ruby hash方法Hash.rassoc(obj)方法 (Hash.rassoc(obj) Method) In this article, we will study about Hash.rassoc(obj) Method. The working of the method can’t be assumed because of it’s quite a different name. Let us read its definition and understand its imp…

JavaMail(四):接收邮件

2019独角兽企业重金招聘Python工程师标准>>> 接收邮件采用POP3协议进行接收,简单的一个接收邮件案例如下 /*** 接收邮件*/ public static void receive() throws Exception { // 准备连接服务器的会话信息 Properties props new Properties(); props.se…

html流动海报css,海报网css代码怎样把模块移到右面?最好把代码直接给我!嘿嘿。...

匿名用户13级2010-09-15 回答CSS是Cascading style Sheets的简称,中文译作“层叠样式表单”. 实际上它是一组样式。你可能对CSS这个名词比较陌生,实际上无论你用Internet Explorer还是Netscape Navigator在网上冲浪,几乎随时都在与CSS打交道&…

奥鹏东北大学作业答案计算机网络,东北大学17秋学期《计算机网络》在线作业1参考答案...

一、单选题:【15道,总分:75分】东北大学1.IP地址0.0.0.0表示( )。 (满分:5)A. 广播B. 有限广播C. 自环地址D. 本机2.IP协议中,如果首部不含选项字段,则首部长度字段的值应为( )。 (满分:5)A. 0B. 5C. 10D. 203.滑动窗口的作用是…

append生成新变量的时候,没有如预期(It's a feature,not a bug?)

这是我在写一个项目中,遇到的一个golang的feature,如代码所示,我在for循环里,每次用append生成一个新的数组,(当然我以前一直以为可以这样,直到我在stackoverflow上发现不能。)然后将…

jqgrid本地数据例子_办公系统私有云公有云和本地化部署,你选哪个?

随着互联网和云计算技术的发展,我们常常会听到:私有云、公有云和本地化部署,它们分别代表什么意思?无论是国企、民企还是外企,只要有数据,就要思考:到底将数据储存在哪里?选择轻流进…

计算机基础应用的培养活动记录,小学少年宫计算机兴趣小组活动记录表

小学少年宫计算机兴趣小组活动记录表 小学少年宫计算机兴趣小组活动记录表 活动名称:计算机 指导教师: ⅩⅩ 学生姓名 活动地点 计算机教室 活 动 过 程 活动1.认识计算机 ①师:“请同学们按下方盒子上面像大钮扣一样的按钮&#…

C ++ STL中的set :: lower_bound()函数

C STL set :: lower_bound()函数 (C STL set::lower_bound() function) set::lower_bound() function is a predefined function, it is used to get the lower bound of any element in a set. set :: lower_bound()函数是预定义的函数,用于获取集合中任何元素的下…

flume入门

# example.conf: A single-node Flume configuration# Name the components on this agent #给那三个组件取个名字 a1.sources r1 a1.sinks k1 a1.channels c1# Describe/configure the source #类型, 从网络端口接收数据,在本机启动, 所以localhost, typespoolDir采集目录源…

原生js设置div隐藏或者显示_JavaScript动画方式控制div元素的隐藏和显示

jQuery实现此功能相对比较简单,具体参阅点击按钮动画方式隐藏和显示div一章节。结合CSS3实现此功能也非常便利和适合,具体参阅JavaScript与CSS3动画方式改变元素尺寸一章节。原生JavaScript实现稍显麻烦,下面就通过代码实例介绍一下如何实现此…

python线程任务run_Python线程类| 带有示例的run()方法

python线程任务runPython Thread.run()方法 (Python Thread.run() Method) Thread.run() method is an inbuilt method of the Thread class of the threading module in Python. This method is used to represent a threads activity. It calls the method expressed as the …

哪个计算机无法做到双屏显示,怎么启用双屏显示设置【图文介绍】

随着生活质量的提升,人们对于便利的要求越来越高,电脑的双屏显示成为现在用户越来越关注的对象之一。比如炒股操作中,人们既要关注大盘的走动趋势,又要关注特定股票的走势,在普通的屏幕上就需要不断地切换页面&#xf…

1.django 开发环境搭建

2019独角兽企业重金招聘Python工程师标准>>> 本教程使用的开发环境 本教程写作时开发环境的系统平台为 Windows 10 (64 位),Python 版本为 3.5.2 (64 位),Django 版本为 1.10.6。 建议尽可能地与…