Page 315 - CITS - Computer Software Application -TT
P. 315
COMPUTER SOFTWARE APPLICATION - CITS
JAVA Arithmetic, Assignment, Relational, Logical,
Increment / Decrement operators and expressions
Java Operators
Operators are used to perform operations on variables and values.
Java supports the following types of operators
• Arithmetic Operators
• Assignment Operators
• Logical Operators
• Relational Operators
• Unary Operators
• Bitwise Operators
• Ternary Operators
• Shift Operators
Arithmetic Operators in Java
Arithmetic Operators are used to performing mathematical operations like addition, subtraction, etc. Assume that
A = 10 and B = 20 for the below table.
Operator Description Example
+ Addition Adds values on either side of A+B=30
the operator
- Subtraction Subtracts the right-hand A-B=-10
operator with left-hand operator
Multiplies values on either side A*B=200
* Multiplication of the operator
/ Division Divides left hand operand with A/B=0
right hand operator
% Modulus Divides left hand operand by A%B=0
right hand operand and returns
remainder
302
CITS : IT&ITES - Computer Software Application - Lesson 78 - 84