3.11. Boolean Logical Operators: !, ^, &, |

Boolean logical operators include the unary operator ! (logical complement) and the binary operators & (logical AND), | (logical inclusive OR), and ^ (logical exclusive OR, a.k.a. logical XOR). Boolean logical operators can be applied to boolean operands, returning a boolean value. The operators &, |, and ^ can also be applied to integral operands to perform bitwise logical operations (see Section 3.13, p. 75).

Given that x and y represent boolean expressions, the boolean logical operators are defined in Table 3.9. In the table, the operators are ranked, with the operator having the highest precedence first.

Table 3.9. Boolean Logical Operators
Logical complement!xReturns the complement of the truth-value ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.