博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java ResourceBundle containsKey()方法及示例
阅读量:2526 次
发布时间:2019-05-11

本文共 1980 字,大约阅读时间需要 6 分钟。

ResourceBundle类containsKey()方法 (ResourceBundle Class containsKey() method)

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

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

  • containsKey() method is used to check whether the given key element (key_ele) exists or not exists in this ResourceBundle or its super bundles.

    containsKey()方法用于检查此ResourceBundle或其超级捆绑包中是否存在给定的关键元素(key_ele)。

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

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

  • containsKey() method may throw an exception at the time of checking the existence of the given element.

    在检查给定元素是否存在时, containsKey()方法可能会引发异常。

    NullPointerException: This exception may throw when the given parameter is null exists.

    NullPointerException :当给定参数为null时,可能引发此异常。

Syntax:

句法:

public boolean containsKey(String key_ele);

Parameter(s):

参数:

  • String key_ele – represents the key element of this ResourceBundle.

    字符串key_ele –表示此ResourceBundle的关键元素。

Return value:

返回值:

The return type of this method is boolean, it returns true when the given key element exists in this ResourceBundle or its super bundle otherwise it returns false.

此方法的返回类型为boolean ,当给定的key元素存在于此ResourceBundle或其超级捆绑包中时,它返回true ,否则返回false

Example:

例:

// Java program to demonstrate the example // of boolean containsKey(String key_ele) method // of ResourceBundleimport java.util.*;public class ContainsKeyOfResourceBundle {
public static void main(String[] args) {
// Instantiates ResourceBundle with // some locale ResourceBundle rb = ResourceBundle.getBundle("IncludeHelp...", Locale.FRANCE); // By using containsKey() method isto // check whether the given key exists or // not in this ResourceBundle boolean status = rb.containsKey("IncludeHelp..."); // Display status System.out.println("rb.containsKey(IncludeHelp...): " + status); }}

Output

输出量

rb.containsKey(IncludeHelp...): true

翻译自:

转载地址:http://nwvzd.baihongyu.com/

你可能感兴趣的文章
自定义滚动条
查看>>
APP开发手记01(app与web的困惑)
查看>>
笛卡尔遗传规划Cartesian Genetic Programming (CGP)简单理解(1)
查看>>
mysql 日期时间运算函数(转)
查看>>
初识前端作业1
查看>>
为啥程序会有bug?
查看>>
跨域技术
查看>>
JS里的居民们7-对象和数组转换
查看>>
计算两个日期的时间间隔,返回的是时间间隔的日期差的绝对值.
查看>>
python初体验
查看>>
配置vue,vue脚手架的应用(老版本)
查看>>
linux下防火墙iptables原理及使用
查看>>
经典C面试真题精讲
查看>>
Remove Duplicates from Sorted List解题报告
查看>>
ffmpeg格式转换命令
查看>>
万方数据知识平台 TFHpple +Xpath解析
查看>>
Hive实现oracle的Minus函数
查看>>
秒杀多线程第四篇 一个经典的多线程同步问题
查看>>
RocketMQ配置
查看>>
vs code调试console程序报错--preLaunchTask“build”
查看>>