A *boolean* expression is one that has a value that is either
`true` or `false`. Use a `boolean` variable
to hold the value of a boolean expression.

A *relational operator* is one that compares two values and produces a
`boolean` result. (In
contrast, an arithmetic operator combines one or more values to produce a
new arithmetic value.)

Relational operators | ||

Symbol |
Meaning |
Example |

== |
equal to | if ( a == 5 ) |

> |
greater than | if ( salary > 30000 ) |

< |
less than | if ( 0 < salary ) |

!= |
not equal to | if ( a != b ) |

>= |
greater than or equal to | if ( salary >= 10000 ) |

<= |
less than or equal to | if ( 20000 <= salary ) |

- The two operands of a relational operator should be of the same data type, although Java does allow some mixing of types.
- Relational operators return a
`true`or`false`answer. - Note the difference between test for equality (
`==`) and the assignment operator (`=`).