Читать книгу OCP Oracle Certified Professional Java SE 17 Developer Study Guide - Jeanne Boyarsky - Страница 155
Relational Operators
ОглавлениеWe now move on to relational operators, which compare two expressions and return a boolean
value. Table 2.8 describes the relational operators you need to know for the exam.
TABLE 2.8 Relational operators
Operator | Example | Description |
---|---|---|
Less than | a < 5 | Returns true if the value on the left is strictly less than the value on the right |
Less than or equal to | b <= 6 | Returns true if the value on the left is less than or equal to the value on the right |
Greater than | c > 9 | Returns true if the value on the left is strictly greater than the value on the right |
Greater than or equal to | 3 >= d | Returns true if the value on the left is greater than or equal to the value on the right |
Type comparison | e instanceof String | Returns true if the reference on the left side is an instance of the type on the right side (class, interface, record, enum, annotation) |