Comparison Operators
noun
say it: “kum-PAIR-ih-sun OP-uh-ray-terz” /kəmˈpɛrɪsən ˈɑpəreɪtərz/
The symbols == != < > <= and >= that compare two values and answer true or false.
What is Comparison Operators in Java?
Comparison Operators — Operators that compare two values and produce true or false.
class Venue {
boolean canEnter(int age) {
boolean isAdult = age >= 18;
boolean isSenior = age >= 65;
if (isAdult && !isSenior) {
return true;
}
return false;
}
}
In a sentence
- “I used comparison operators to check that age >= 18 before showing the sign-up form.”
Level: Novice · More Java terms at this level
Updated