3.12. Conditional Operators: &&, ||
Conditional operators && and || are similar to their counterpart logical operators & and |, except that their evaluation is short-circuited. Given that x and y represent values of boolean expressions, the conditional operators are defined in Table 3.12. In the table, the operators are listed in decreasing precedence order.
Conditional AND | x && y | true if both operands are true; otherwise, false. |
Conditional OR | x || y | true if either or both operands are true; otherwise, false. |
Unlike their logical counterparts & and |, which can also be applied to integral operands for bitwise operations, the conditional operators && and || can only be applied to boolean operands. Their evaluation ...
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.