Operators in Java cwipedia.in








There are four Types of Operators available in Java
  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Logical operators
  • Bitwise operators



1)Arithmetic Operators
     
+(Addition)
Eg:
x+y=1

-(Subtraction)
Eg:
x-y=1

*(Multiplication)
Eg:
x*y=1;

/(Divide)
Eg:
x/y=1;


2)Assignment Operators

=(Equal)
Eg:
x=5;

+=
Eg:
x+=1

-=
Eg:
x-=1

*=
Eg:
x*=1

/=
Eg:
x/=1

3)Comparison Operator 

==(Equal to )
Eg:
x==y

!=(Not equal to)
Eg:
x!=y

<=(Less than equal to)
Eg:
x<=y

>=(Greater than equal to)
Eg:
x>=y

>(Greater than)
Eg:
x>y

<(Less than)
Eg:
x<y


4)Logical Operators

||(Logical Or)
Eg:
x<1||x<2

&&(logical and)
Eg:
x<1&&x<2

!(Logical not)
Eg:
!(x<1||x<2)


Comments