The following table lists Java Boolean logical operators.
All Boolean logical operators can be used only with boolean operand(s).
Operators | Meaning | Type | Usage | Result |
---|---|---|---|---|
! | Logical NOT | Unary | !true | false |
&& | Short-circuit AND | Binary | true && true | true |
& | Logical AND | Binary | true & true | true |
|| | Short-circuit OR | Binary | true || false | true |
| | Logical OR | Binary | true | false | true |
^ | Logical XOR(Exclusive OR ) | Binary | true ^ true | false |
&= | AND assignment | Binary | test &= true | true |
|= | OR assignment | Binary | test |= true | true |
^= | XOR assignment | Binary | true ^= true | true |