Professional Documents
Culture Documents
programming language
JAVA
Submitted to
submitted by
Mr. Mohit Angurala
Girish Puri
2014CSA1715
B.tech CSE
Java has a rich set of operators with which we can manipulate
variables. Java operators can be divided into the following
groups :
1.ARITHMETIC
2.RELATIONAL
3.BITWISE
1. ARITHMETIC OPERATORS :
In mathematical expressions, the usage of Arithmetic operators
are in same way that they are used in algebra. The following
table lists the arithmetic operators:
Sr.No.
Operators and examples
( + ) Addition
1 It Adds values on either side of the operator
Example: A + B will give 95.
( - ) Subtraction
2 It Subtracts right-hand operand from left-hand
operand
Example: A - B will give -15.
( * ) Multiplication
3 It Multiplies values on Left and right side of the
operator
Example: A * B will give 2200.
( / ) Division
4 It Divides left-hand operand by right-hand
operand
Example: B / A will give 1.375.
( % ) Modulus
5 It returns remainder after dividing left-hand
operand by right-hand operand
Example: B % A will give 15.
( ++ ) Increment
6 Increases the value of operand by 1
Example: B++ gives 56.
( -- ) Decrement
7 Decreases the value of operand by 1
Example: B-- gives 54 .
2. RELATIONAL OPERATORS
It is a programming language constructor or operator that test
or define some kind of relations between two entities. These
include numerical equality and inequalities. Relational
operators are binary operators. It returns boolean value I.e.it
will return true or false. Most of the relational operators are
used in if statement and inside looping statement in order to
check truthness or falseness of condition.
== (equal to)
Example: (A == B) is false.
Example: (A != B) is true.
It Checks whether the value of left side operand is less than the
value of right side operand, if yes then condition will be
evaluated true.
a = 0011 1100
b = 0000 1101
-----------------
~a = 1100 0011
Type of Bitwise operators are following :-
( | ) bitwise or
( ^ ) bitwise XOR
4
( ~ ) bitwise compliment
5
( << ) left shift