As said in thinking in Java if you have 2 boolean objects, x
and y
you can use either x= x&&y
and x=x&y
on them, so why its necessary having both types?
The two operators act differently:
&
will always evaluate both operands&&
is short-circuiting - if the first operand evaluates to false
, then the overall result will always be false, and the second operand isn't evaluatedSee the Java Language Specification for more details:
&
&&
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With