You are on page 1of 24

OPERATORS

Jenishiya M
Operators are special symbols that
perform specific operations on
one, two, or three operands, and
Insert Your Image And Send To Back

then return a result.


TYPES OF
OPERATORS
1 ARITHMETIC OPERATOR

2 ASSIGNMENT OPERATOR

3 RELATIONAL OPERATOR

4 TERNARY OPERATOR

5 BITWISE OPERATOR

6 LOGICAL OPERATOR

7 UNARY OPERATOR

8 SHIFT OPERATOR
Arithmetic Operator

ADDITION SUBTRACTION
MULTIPLICATION MODULUS
(+) (-)
(*) DIVISION
This is a binary
This operator is a (/)z operator that is used
This operator is a This operator is a binary This is a binary operator
binary operator to return the
binary operator operator that is used to divide the
and is used to remainder when the
and is used to add two and is used to multiply two first operand(dividend) by
subtract two the second
first
operands. operands. operands . operand(dividend) is
operand(divisor) and give divided by the second
the quotient as a result. operand(divisor).

.
Output:
ASSIGNMENT OPERATER

• Assignment operators are used to assign


values to variables.
• The left side operand of the assignment
operator is a variable, and the right side
operand of the assignment operator is a
value.
• The value on the right side must be of the
same data type of the operand on the left
side. Otherwise, the compiler will raise an
error
Types Of Assignment Operator

Addition 

Subtraction 

Multiplication 

Division 

Modulo 
Output:
RELATIONAL OPERATOR
 Relational operators like ==, != , >,
<, >=, and <= are key in Java for
comparing values, enabling the code
to make decisions and effectively
control the flow based on these
comparisons.
 They are essential for implementing
logic in conditional statements and
loops.
Output:
Ternary Operator
 Java ternary operator is the only conditional
operator that takes three operands.
 It’s a one-liner replacement for the if-then-else
statement
15% and is used a lot in Java programming.
20%
60%
Output:
o In Java, an operator is a symbol that performs the
specified operations.
Bitwise o There are four types of bitwise operator in java.
o They are
1.Biwise AND
Opertor 2.Biwise exclusive OR
3.Biwise inclusive OR
4.Bitwise complement
Output:
Logical
Operator
 Logical operators are used to
perform logical “AND”, “OR”
and “NOT” operations, i.e. the
function similar to AND gate
and OR gate in digital
electronics.
 They are used to combine two
or more conditions/constraints
or to complement the
evaluation of the original !
condition under particular
consideration
Output:
• Java unary operators are the types that
need only one operand to perform any
operation like increment, decrement,

UNARY
negation, etc.

OPERATOR
Increment(++) And Decrement(--)
Post Increment
When placed after the variable name, the value of the
operand is incremented but the previous value is
retained temporarily until the execution of this Post decrement
statement and it gets updated before the execution of When placed after the variable name, the value of
the next statement. . the operand is decremented but the previous values
is retained temporarily until the execution of this
statement and it gets updated before the execution of
the next statement

Pre increment
When placed before the variable name, the operand’s
value is incremented instantly. Pre decrement
When placed before the variable name, the
operand’s value is decremented instantly.
Output:
 By shifting the bits of its first operand right or
left, a shift operator performs bit manipulation on

SHIFT data.
 The shift operators available in the Java
programming language are listed below.
OPERATOR  The shift operator is a java operator that is used
to shift bit patterns right or left.

The left shift operator


moves all bits by a
Signed Left Shift <<
given number of bits to
the left.

The right shift operator


moves all bits by a
Signed Right Shift >>
given number of bits to
the right.

It is the same as the


signed right shift, but
Unsigned Right Shift >>> the vacant leftmost
position is filled with 0
instead of the sign bit.
Output:
N K You
TH A

You might also like