Chapter 3
Operators

java provides a rich operators environment most of its operators can be divided into the following four groups :
1.Arithmetic Operators :
Operator | Result | |
+ | ![]() | Addition |
- | ![]() | Subtraction |
* | ![]() | Multiplication |
/ | ![]() | Division |
% | ![]() | Modulus |
++ | ![]() | Increment |
+= | ![]() | Addition assignment |
-= | ![]() | Subtraction assignment |
*= | ![]() | Multiplication assignment |
/= | ![]() | Division assignment |
%= | ![]() | Modulus assignment |
-- | ![]() | Decrement |
2.Bitwise Operators :
Operator | Result | |
~ | ![]() | 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 :
Operator | Result | |
== | ![]() | Equal to |
!= | ![]() | Not equal to |
> | ![]() | Greater than |
< | ![]() | less than |
>= | ![]() | Greater than or equal to |
<= | ![]() | Less than or equal to |
4.Boolean Logical Operators :
Operator | Result | |
& | ![]() | Logical AND |
| | ![]() | Logical OR |
^ | ![]() | Logical XOR |
|| | ![]() | OR |
&& | ![]() | AND |
! | ![]() | NOT |
&= | ![]() | AND assignment |
!= | ![]() | OR assignment |
^= | ![]() | XOR assignment |
== | ![]() | Equal to |
!= | ![]() | Not equal to |
: | ![]() | Ternary if-then-else |