It looks like you’re getting the hang of this! Let’s explore another set of useful operators available in Java known as relational operators.
Relational operators compare data types that have a defined ordering, like numbers (since numbers are either smaller or larger than other numbers).
Relational operators will always return a boolean value of
Here are a few relational operators:
<: less than.
<=: less than or equal to.
>: greater than.
>=: greater than or equal to.
A relational operator is placed between the two operands (the terms that you want to compare using the relational operator). The result of a relational operation is printed out in the following statement:
System.out.println(5 < 7);
The example above will print out
true because the statement “
5 is less than
7“ is true.
Use one of the relational operators above to compare any two integers.