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
Java Formatter locale()方法与示例相关推荐
- Java IOUtils.copy方法代码示例(亲测)
本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...
- java formatter 填充_Java Formatter format()方法及示例
格式化程序类format()方法 语法:public Formatter format(Locale lo, String frmt, Object... args); public Formatte ...
- java方法参数Bundle,Java ResourceBundle keySet()方法及示例
ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...
- java user directory,Java ProcessBuilder directory()方法与示例
语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...
- Java序列化魔术方法及其示例使用
在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...
- catalog java,Java Connection getCatalog()方法与示例
通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...
- filepermission java,Java FilePermission getActions()方法与示例
FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...
- java exec waitfor,Java Process waitFor()方法与示例
流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...
- java arraylist.add(),Java ArrayList add()方法与示例
ArrayList类add()方法 语法:public boolean add(T ele); public void add(int indices, T ele);add()方法在java.uti ...
最新文章
- Gitlab完整搭建手册+排错
- VMware 无法打开内核设备 \\.\Global\vmx86
- sdwan安全如何加固?六种安全SD-WAN方案分享
- 2015快捷键在哪里设置_炒股软件的选择通达信软件的基本设置
- 【双十二】电商们的文案大战,猫狗快被玩坏了!
- VTK:创建一个圆锥用法实战
- 检测正常和不正常图_医生提醒:激素正常不等于内分泌正常,带你走出内分泌失调误区...
- 【编译原理笔记04】语法分析:自顶向下的分析概述、文法转换、LL1文法
- C++课后习题第五章17
- 仿摩拜单车APP(包括附近车辆、规划路径、行驶距离、行驶轨迹记录,导航等)...
- Vdbench工具文件系统测试记录
- vagrant up 时提示错误 cound not open file
- 内存卡格式化了怎么办?能恢复吗?
- html写一个轮播图响应式布局,响应式banner图片轮播布局代码
- isFinite函数
- React使用cra创建项目,开启装饰器
- 统计公司员工喜欢吃的水果,并打印出最喜欢吃的前K中水果【map关联式容器,k/V结构】
- 手动删除百度全家桶流氓软件
- optimizeinplace
- zsore和经验法则(统计学原理)