3.9. Relational Operators: <, <=, >, >=
Given that a and b represent numeric expressions, the relational (also called comparison) operators are defined as shown in Table 3.6.
a < b | a less than b? |
a <= b | a less than or equal to b? |
a > b | a greater than b? |
a >= b | a greater than or equal to b? |
All relational operators are binary operators, and their operands are numeric expressions. Binary numeric promotion is applied to the operands of these operators. The evaluation results in a boolean value. Relational operators have precedence lower than arithmetic operators, but higher than that of the assignment operators.
double hours = 45.5; boolean overtime = hours >= 35.0; // true. boolean order = 'A' < 'a'; // true. Binary numeric ...
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.