order - Will Java continue with condition if it is already proven to be false? -
order - Will Java continue with condition if it is already proven to be false? -
this question has reply here:
difference between & , && 8 answerssay status looks this:
if (false && true) //code
would break away status before reaches true, because false , && never true?
also, if have code this:
boolean dividestotwo (int operand1, int operand2) { if ((operand2 != 0) && operand1 / operand2 == 2) homecoming true; homecoming false; }
would work intended, or error partition zero? (if sec operand zero)
for first part of question see this answer. called short circuit evaluation:
when using&&
sec part evaluated if first part true when using ||
sec part evaluated if first part false for sec part of question:
yes work expected! if operand2
0 evaluation canceled , no partition 0 occurr!
java order condition
Comments
Post a Comment