0% found this document useful (0 votes)
14 views1 page

Arithmetical Operator Arithmetic Operators Are Used To Perform Mathematical Operations On Its Operands

Uploaded by

aribanbhi ashish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

Arithmetical Operator Arithmetic Operators Are Used To Perform Mathematical Operations On Its Operands

Uploaded by

aribanbhi ashish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

(a) Arithmetical operator Arithmetic operators are used to perform mathematical

operations on its operands. Operands of arithmetic operators must be of numeric type.


A few arithmetic operators operate upon one operand. They are called Unary Arithmetic
operators. Other arithmetic operators operate upon two operands. They are called
Binary Arithmetic operators. As an example consider the below statement: int a = 10 +
20; Here, the addition arithmetic operator, represented by the symbol + will add 10 and
20. So variable a will be 30.

(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.

You might also like