Chapter 3 Operators



Chapter 3  Operators
java provides a rich operators environment most of its operators can be divided into the following four groups :
1.Arithmetic Operators :

OperatorResult
+Addition
-Subtraction
*Multiplication
/Division
%Modulus
++Increment
+=Addition assignment
-=Subtraction assignment
*=Multiplication assignment
/=Division assignment
%=Modulus assignment
--Decrement
2.Bitwise Operators :

OperatorResult
~Bit wise unary NOT
&Bit wise AND
|Bit wise OR
^Bit wise Exclusive OR
>>Shift right
>>>Shift right zero fill
<<Shift left
&=Bit wise AND assignment
!=Bit wise OR assignment
^=Bit wise Exclusive OR assignment
>>=Shift right assignment
>>>=Shift right zero assignment
<<=Shift left assignment

3.Relational Operators :

OperatorResult
==Equal to
!=Not equal to
>Greater than
<less than
>=Greater than or equal to
<=Less than or equal to

4.Boolean Logical Operators :

OperatorResult
&Logical AND
|Logical OR
^Logical XOR
||OR
&&AND
!NOT
&=AND assignment
!=OR assignment
^=XOR assignment
==Equal to
!=Not equal to
:Ternary if-then-else