我for循环里面套一个try....如果某个o出现异常了?那么,for会被中止吗?而且,for循环体下面的代码还会被执行吗?
public boolean aa(List bb) {
for (T o: bb) {
try {
method();
} catch (Exception e) {
return false;
}
}
System.out.println("ghghfghg");
return true;
}
我的想法,去遍历list,看看是否有不合法的内容,有的话,提示出是哪些不合法。不知道这样行不行。有其他方法吗?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你都
return false;了还会执行么……如果你把
return false;注释掉就会继续执行了