Conditional, Equality and Relational operators in Java are used to compare the value between variables, and also between expressions. When a condition is evaluated, it always results in a value of data type boolean, in other words, true or false.
Moreover, the equality and relational operators are certainly not unique to programming in Java, and are widely known in mathematics. Further down on this page, we show a few straightforward exercises that can be good to repeat as we will continue to use equality and relational operators frequently.
Furthermore, similar to the equality and relational operators, the conditional operators are certainly not unique to programming in Java. Further down on this page, we show a few straightforward exercises that can be good to repeat as we will continue to use the conditional operators frequently.
|AND||a && b||True if a and b are true|
|OR||a || b||True if a or b are true|
|NOT||!a||True if a is false|
|Equal to||a == b||True if a and b are equal|
|Not equal to||a != b||True if a are false and b are false|
|Greater than||a > b||True if a are greater than b|
|Less than||a < b||True if a are less than b|
|Less than or equal to||a <= b||True if a is smaller or as large as b|
|Greater than or equal to||a >= b||True if a is larger or as large as b|
Let’s take an exercise so that we can test how some conditional, equality, and relational operators in Java work. The task is to fill in the spaces in the boxes with True or False depending on the expression. Given in the task is that: a = 10 and that b = 20.
More information about the Conditional, Equality and Relational operators in Java is available at the Oracle website