Page 109 - AP Computer Science A, 7th edition
P. 109
<= less than or if
equal to
(height <= 6)
NOTE
1. Relational operators are used in boolean expressions that
evaluate to true or false.
boolean x = (a != b); //initializes x to
true if a != b,
// false otherwise
return p == q; //returns true if p equals q,
false otherwise
2. If the operands are an int and a double, the int is promoted to a double as for arithmetic operators.
3. Relational operators should generally be used only in the comparison of primitive types (i.e., int, double, or boolean). User-defined types are compared using the equals and compareTo methods.
4. Be careful when comparing floating-point values! Since floating-point numbers cannot always be represented exactly in the computer memory, they should not be compared directly using relational operators.
Do not routinely use == to test for equality of floating-point numbers.
Optional topic
Comparing Floating-Point Numbers
Because of round-off errors in floating-point numbers, you can’t rely on using the == or != operators to compare two double values for equality. They may differ in their last significant digit