The Java ||
operator (logical or operator) does not evaluate additional arguments if the left operand is true
. If you wanted to do that, you can use |
(bitwise or operator), although, according to the name, this is a little of a hack.
http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.23
Thus, && computes the same result as & on boolean operands. It differs only in that the right-hand operand expression is evaluated conditionally rather than always.
http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.24
Thus, || computes the same result as | on boolean or Boolean operands. It differs only in that the right-hand operand expression is evaluated conditionally rather than always.
Extra: it is considered bad programming style to depend on these semantics to conditionally call code with side effects.