Boolean.valueOf()方法:
1 public static Boolean valueOf(String s) {
2 return toBoolean(s) ?
TRUE : FALSE;
3 }
Boolean.toBoolean()方法
private static boolean toBoolean(String name) {
return ((name !=
null) && name.equalsIgnoreCase("true"
));
}
所以使用Boolean.valueOf(),当字符串不为空且字符串等于“true”(忽略大小写)返回true,否则为false
转载于:https://www.cnblogs.com/zhima-hu/p/7511050.html