ListResourceBundle类的getContents()方法 (ListResourceBundle Class getContents() method)

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

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

  • getContents() method is used to return an enumeration of all the keys that exist in this ListResourceBundle and its superclass.

    getContents()方法用于返回此ListResourceBundle及其超类中存在的所有键的枚举。

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

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

  • getContents() method does not throw an exception at the time of returning an enumeration of elements.

    在返回元素枚举时, getContents()方法不会引发异常。

Syntax:

句法:

    public Enumeration getKeys();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of the method is Enumeration, it gets an Enumeration of all the existing keys in this ListResourceBundle and its super bundle.

该方法的返回类型为Enumeration ,它获取此ListResourceBundle及其超级捆绑包中所有现有键的Enumeration。

Example:

例:

// Java program to demonstrate the example
// of Enumeration getKeys()  method of
// ListResourceBundle
import java.util.*;
// Instantiates a class that extends
// ListResourceBundle
class GetKey extends ListResourceBundle {// By using getContent() method is to
// get the contents in the form of
// 2D objects
protected Object[][] getContents() {return new Object[][] {{"10",
"C"
}, {"20",
"C++"
}, {"30",
"JAVA"
}, {"40",
"SFDC"
}, {"50",
"PHP"
}
};
}
}
public class Main {public static void main(String[] args) {// Instantiates an object of
// GetKeys
GetKey get_c = new GetKey();
// By using getKeys() method is
// return all the keys in the
// form of an Enumeration
System.out.println("get_c.getKeys(): ");
for (Enumeration en = get_c.getKeys(); en.hasMoreElements();)
System.out.println(en.nextElement());
}
}

Output

输出量

get_c.getKeys():
50
40
30
20
10

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

Java ListResourceBundle getKeys()方法与示例相关推荐

  1. Java IOUtils.copy方法代码示例(亲测)

    本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...

  2. java user directory,Java ProcessBuilder directory()方法与示例

    语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...

  3. Java序列化魔术方法及其示例使用

    在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...

  4. catalog java,Java Connection getCatalog()方法与示例

    通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...

  5. filepermission java,Java FilePermission getActions()方法与示例

    FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...

  6. java方法参数Bundle,Java ResourceBundle keySet()方法及示例

    ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...

  7. java exec waitfor,Java Process waitFor()方法与示例

    流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...

  8. java arraylist.add(),Java ArrayList add()方法与示例

    ArrayList类add()方法 语法:public boolean add(T ele); public void add(int indices, T ele);add()方法在java.uti ...

  9. java rollback用法,Java Connection rollBack()方法与示例

    回滚操作将撤消当前事务所做的所有更改,即,如果调用Connection接口的rollBack()方法,则所有修改都将还原到最后一次提交. 您还可以通过将所需的Savepoint对象作为参数传递给此方法 ...

最新文章

  1. 人工智能写的散文之白色月光下
  2. 在java web项目中实现随项目启动的额外操作
  3. 借助Fargate和EKS,AWS甚至可以实现Cloud-ier和Kuberneties-ier
  4. 7-8 最长连续递增子序列 (15 分)
  5. 加速ASP.NET Core WEB API应用程序——第1部分
  6. 【南邮操作系统实验】页面置换算法(FIFO、LRU、OPT)图形化界面(JavaFx)
  7. ip首部可选字段_IP报文格式及各字段意义
  8. ubuntu中安装hp惠普打印机
  9. Python 名称空间以及函数的补充
  10. C#模拟鼠标和键盘操作
  11. tomcat部署web应用及架设论坛
  12. layout-v21透明主题不生效的bug
  13. 64位操作系统注册ocx控件失败,提示:模块加载失败请确保该二进制存储在指定路径中。
  14. 【牛客专项练习】计算机基础—网络基础
  15. 计算机视觉——棋盘格标定法获取相机内参外参
  16. easyswoole连接mysql
  17. 【清华集训2014】玛里苟斯(数学 线性基)
  18. 丢失的拜占庭将军问题之谜
  19. 软件实施工程师面试总结
  20. 计算机基础知识华工,计算机应用基础(统考)·随堂练习2017秋华工答案

热门文章

  1. aix升级新安装oracle,AIX 5L上安装和升级Oracle
  2. php curl cookie,php中curl获取返回页面的cookie
  3. grafana zabbix 模板_Grafana + Zabbix 监控系统搭建
  4. 检测php加密方式,一种php加密方式
  5. 按月拆分数据库表--oracle
  6. 左偏树 P3377【模板】左偏树(可并堆)
  7. Javascript Proxy对象 简介
  8. [js高手之路] html5 canvas系列教程 - 掌握画直线图形的常用API
  9. 传统存储做到极致也惊人!看宏杉科技发布的CloudSAN
  10. informatica中元数据管理