java calendar

日历类的getDisplayNames()方法 (Calendar Class getDisplayNames() method)

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

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

  • getDisplayNames() method is used to return Map that contains all field names of the calendar will be updated in the given field(fi) values in the given style(st) and Locale(lo).

    getDisplayNames()方法用于返回包含日历所有字段名称的Map,这些日历名称将在给定style(st)和Locale(lo)的给定field(fi)值中更新。

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

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

  • getDisplayNames() method may throw an exception at the time of returning Map object.

    getDisplayNames()方法在返回Map对象时可能会引发异常。

    • IllegalArgumentException: This exception may throw when the given field(fi) or style(st) are not valid.IllegalArgumentException :如果给定的field(fi)或style(st)无效,则可能引发此异常。
    • NullPointerException: This exception may throw when the given parameter Locale(lo) is null exists.NullPointerException :如果给定参数Locale(lo)为null,则可能引发此异常。

Syntax:

句法:

    public Map getDisplayNames(int fi, int st, Locale lo);

Parameter(s):

参数:

  • int fi – it represents the field(fi) of this Calendar.

    int fi –它代表此日历的字段(fi)。

  • int st – it represents the style that will implemented to the string denotation.

    int st –它表示将对字符串符号实施的样式。

  • Locale lo – it represents the locale of the string denotation.

    语言环境lo –它表示字符串符号的语言环境。

Return value:

返回值:

The return type of the method is String, it returns Map object that contains names display in the given style and locale and their desired field(fi) values otherwise it returns null when no string denotation exists.

该方法的返回类型为String ,它返回Map对象,该对象包含以给定样式和语言环境显示的名称以及所需的field(fi)值,否则,当不存在任何字符串符号时,它返回null。

Example:

例:

// Java Program to demonstrate the example of
// Map getDisplayNames() method of Calendar
import java.util.*;
public class GetDisplayNames {public static void main(String args[]) {// Instantiating a Calendar object
Calendar ca = Calendar.getInstance();
// Instantiating a Locale object
Locale lo = Locale.getDefault();
// By using getDisplayNames() method is to
// display the names
Map < String, Integer > m = ca.getDisplayNames(Calendar.DAY_OF_WEEK,
Calendar.LONG, lo);
NavigableMap < String, Integer > nm = new TreeMap < String, Integer > (m);
// Displaying the results
System.out.println(" ca.getDisplayNames(): " + nm);
}
}

Output

输出量

ca.getDisplayNames(): {Friday=6, Monday=2, Saturday=7, Sunday=1, Thursday=5, Tuesday=3, Wednesday=4}

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

java calendar

java calendar_Java Calendar getDisplayNames()方法与示例相关推荐

  1. cdate在java中_Java Calendar.add方法代码示例

    本文整理汇总了Java中java.util.Calendar.add方法的典型用法代码示例.如果您正苦于以下问题:Java Calendar.add方法的具体用法?Java Calendar.add怎 ...

  2. java的gettime,java.util.Calendar.getTime()方法实例

    全屏 java.util.Calendar.getTime()方法返回一个Date对象,它表示此Calendar的时间值 声明 以下是java.util.Calendar.getTime()方法的声明 ...

  3. java散列法的运用实例,Java HashMap compute() 使用方法及示例

    Java HashMap compute() 使用方法及示例 Java HashMap compute()方法计算一个新值,并将其与哈希映射中的指定键相关联. compute()方法的语法为: has ...

  4. math的用法在java中的使用,Java Math cbrt() 使用方法及示例

    Java Math cbrt() 使用方法及示例 Java Math cbrt()方法返回指定数字的立方根. cbrt()方法的语法为: Math.cbrt(double num) 注意:cbrt() ...

  5. java arraylist 方法返回值,Java ArrayList get() 使用方法及示例

    Java ArrayList get() 使用方法及示例 Java ArrayList get()方法返回指定位置存在的元素. get()方法的语法为: arraylist.get(int index ...

  6. java calendar_Java Calendar internalGet()方法与示例

    java calendar 日历类internalGet()方法 (Calendar Class internalGet() method) internalGet() method is avail ...

  7. java calendar_Java Calendar after()方法与示例

    java calendar Calendar类after()方法 (Calendar Class after() method) after() method is available in java ...

  8. java calendar_Java Calendar complete()方法与示例

    java calendar Calendar类的complete()方法 (Calendar Class complete() method) complete() method is availab ...

  9. java calendar_Java Calendar getLeastMaximum()方法与示例

    java calendar Calendar类的getLeastMaximum()方法 (Calendar Class getLeastMaximum() method) getLeastMaximu ...

最新文章

  1. 他开发了 redux,昨晚“字节一面”却挂了?
  2. Android内存控制小技巧-使用矢量图来节省你的内存并简化你的开发。
  3. 上千个电脑文件怎么搬?用Python一键复制移动
  4. LBFT跨链共识机制
  5. elinput内容过长显示悬浮框_excel中一直被忽视的名称框,用好了也能提高效率
  6. Unicode编码 转载 侵权删
  7. 统计php 代码行数,PHP实现统计代码行数小工具
  8. Fedora14 nfs配置 + tiny210 挂载nfs
  9. openpyxl 获取worksheet颜色
  10. JavaScript字符统计出现次数
  11. 已从IT辞职4年,誓要做个不死的闯将!!!(有多少IT兄弟想辞职创业的?)
  12. 基于java博网即时通讯软件的设计与实现
  13. 使用Python+Pandas+Statsmodels建立线性回归模型预测房价
  14. 关于高分辨率屏幕中VMware虚拟机的一些问题的解决
  15. Python 棋子移动游戏
  16. 【python】PLY词法分析实验「编译原理」
  17. Mac 系统不兼容移动硬盘无法识别怎么办
  18. Android SDK 国内下载代理设置
  19. matlab unwrap angle,matlab之unwrap函数
  20. 疫情反复,如何轻松居家办公?——快解析内网穿透

热门文章

  1. Python GIL
  2. python 学习2 /输入/ 输出 /列表 /字典
  3. linux进程cpu时间片,能讲一下在Linux系统中时间片是怎么分配的还有优先级的具体算法是...
  4. ubutun 更换网络源_「ubuntu脚本1」开启ssh替换第三方源开启tab键补齐屏蔽nouveau
  5. 登陆拦截拦截ajax,过滤器实现登录拦截需要注意的问题(AJAX请求的处理)
  6. TensorFlow构建二维数据拟合模型(3)
  7. git 命令 clone分支的代码
  8. UIViewController生命周期的理解
  9. IBM 前面板显示信息提示
  10. Mybatis源码之核心流程分析