Which operators will always evaluate all operands? a) | | b) + c) && d) % e) ?: The correct answer given is 'b' and 'd'. According to me 'e' should also be correct. Somebody please throw some light on this.
e is not correct (a<b)?this will execute:if the condition isfalse> if (a<b) evaluates to true then the part after ? evaluates, the second half does not evaluate> but if the condition(a<b) is false , the true part will not execute > so if does not opeate on everything
sanjeev, ?: operator is not true because it's depend's on the condition if the condition is true then the statement immediately after the colon get's executed and the other(false) part is left untouched,therefore that part is not evaluated at all. In the case of && same thind happen's if the first operand is false, the cursor does not evaluate the second operand.