Tuesday 8 November 2016

OPERATORS IN JAVA



   Arithmetic Operators:
Operators
Result
+
Addition
-
Substraction(also unary minus)
*
Multiplication
/
Division
%
Modulus
++
Increment
+=
Addition Assignment
-=
Substraction  Assignment
*=
Multiplication Assignment
/=
Division Assignment
%=
Modulus Assignment
--
Decrement

   Bitwise Operators:
Operators
Result
~
Bitwise unary NOT
&
Bitwise AND
|
Bitwise OR
^
Bitwise exclusive OR
>> 
Shift right
>>> 
Shift right zero fill
<< 
Shift left
&=
Bitwise ANDAssignment
|=
Bitwise ORAssignment
^=
Bitwise exclusive ORAssignment
>>=
Shift rightAssignment
>>>=
Shift right zero fill Assignment
<<=
Shift left Assignment

    Relational Operators:
Operators
Result
==
Equal to
!=
Not equal to
Greater than
Less than
>=
Greater than equal to
<=
Less than equal to

   Boolean Logical Operators:
Operators
Result
&
Logical AND
|
Logical OR
^
Logical exclusive OR
||
Short-circuit OR
&&
Short-circuit AND
!
Logical unary NOT
&=
AND  Assignment
|=
OR Assignment
^=
exclusive OR Assignment
==
Equal to
!=
Not equal to
?:
Ternary if-then-else

   Assignment Operator:
The assignment operator is a single equal sign, =.
Var=Expression
The assignment operator is used to create chain of assignment:
int x,y,z;
x=y=z=100;
    Operator Precedence:
Highest



( )
[ ]
.

++
--
~
!
*
/
%

+
-


>> 
>>> 
<< 

>=
<=
==
!=


&



^



|



&&



||



?:



=
Op=


Lowest



No comments:
Write comments