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.

Table 3.6. Relational Operators
a < ba less than b?
a <= ba less than or equal to b?
a > ba greater than b?
a >= ba 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.