Java - Boolean Logical Operators

Java Boolean Logical Operators

The following table lists Java Boolean logical operators.

All Boolean logical operators can be used only with boolean operand(s).

Operators Meaning Type UsageResult
! Logical NOT Unary!truefalse
&& Short-circuit AND Binary true && true true
& Logical AND Binary true & true true
|| Short-circuit ORBinary true || falsetrue
| 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