下面节选自类 JSONObject:
public String getString(String key) {
    this.verifyIsNull();
    Object o = this.get(key);
    if(o != null) {
        return o.toString();
    } else {
        throw new JSONException("JSONObject[" + JSONUtils.quote(key) + "] not    found.");
    }
}
以上直接抛出异常,而没有在方法头部声明throws。
但是我自己写的方法中,是同时有throw和throws的。去掉throws就会报错:
Unhundled Exception 。
这是为什么?
Qyouu
					慕运维8079593
					蝴蝶不菲
随时随地看视频慕课网APP
相关分类