Object的equals方法容易抛出空指针异常,应使用常量和确定有值的对象来调用equals方法,如下 12 if(str == "2" || "2".equals(str)){} if(str == "2" || str.equals("2")){} // 错误写法 赞微海报分享
近期评论