Determine if the JSONObject contains a specific key.
Parameters:
key A key string.
Returns:
true if the key exists in the JSONObject.
public boolean has(String key) {
return this.map.containsKey(key);
}
public JSONObject() {
this.map = new HashMap();
}
查询对象是否包含该key,返回boolean,与Map.containsKey(key)用法一致
可以看出是通过使用Map.containsKey(key)方法来做出判断的。