Arithmetical Operator Arithmetic Operators Are Used To Perform Mathematical Operations On Its Operands
Arithmetical Operator Arithmetic Operators Are Used To Perform Mathematical Operations On Its Operands
(b) Relational operator Relational operators are used to determine the relationship between
the operands. Relational operators compare their operands to check if the operands are
equal to ( == ), not equal to ( != ), less than ( < ), less than equal to ( <= ), greater than ( > ),
greater than equal to ( >= ) each other. The result of an operation involving relation
operators is a boolean value — true or false. Example: int a = 8; int b = 10; boolean c = a <
b; Here, as a is less than b so the result of a < b is true. Hence, boolean variable c
becomes true.
(c) Logical operator Logical operators operate on boolean expressions to combine the results of
these boolean expression into a single boolean value. Example: int a = 7; int b = 10; boolean c = a
< b && a % 2 == 0; Here, the result of first boolean expression a < b is true and the result of
second boolean expression a % 2 is false. The logical AND operator ( && ) combines these true
and false boolean values and gives a resultant boolean value as false. So, boolean variable c
becomes false.