I think it actually does, as Java knows &&
is logical AND, meaning if one of the booleans is false
, then it doesn't care about the rest of these validations and just returns false
.
It works exactly the same for ||
, if one boolean is true
, then it doesn't care about the rest and returns true.
Also, you could skip the variable and simply return these validations.
public boolean isFormValid() {
return isSharesDepositValid() && isPlotAmtDepositValid()
&& isDevFundDepositValid() && isConstructionDepositValid()
&& isOthersDepositValid() && isSharesDueValid(true) && isSarahDueValid()
&& isANSDueValid() && isDevFundDueValid() && isOthersDueValid();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…