[size=medium]目前看来是抛出异常的方式在多条件的情况更好。不知道大家怎么看
[/size]
[/size]
public class A {
public boolean get() {
if(!method1()){
return false;
}
if(!method2()){
return false;
}
if(!method3()){
return false;
}
return true;
}
public boolean get2() {
try {
method1();
method2();
method3();
} catch (Exception e) {
return false;
}
return true;
}
public boolean method1(){
return true;
}
public boolean method2(){
return true;
}
public boolean method3(){
return true;
}
}