Java: Java Programming For Beginners a simple Start To Java Programming (Written By a software Engineer)


Download 0.82 Mb.
Pdf ko'rish
bet22/95
Sana09.01.2022
Hajmi0.82 Mb.
#261112
1   ...   18   19   20   21   22   23   24   25   ...   95
Bog'liq
Java Programming For Beginners - A Simple Start to Java Programming ( PDFDrive )

The Logical Operators
Logical operators are an integral part of any operator set. The logical operators supported
by Java are listed in the table below.
Operation
Operator
Description
Logical AND
&&
Returns  True  if  both  the
conditions mentioned are true
Logical OR
||
Returns  True  if  one  or  both  the
conditions mentioned are true
Logical NOT
!
Returns  True  if  the  condition
mentioned is False
The Assignment Operators
There are following assignment operators supported by Java language:


Operation
Operator
Description
Simple  assignment
operator
=
Assigns  a  value  on  the  right  to
the variable in the left
Add  -  assignment
operator
+=
Adds  the  value  on  the  right  to
the  value  of  the  variable  on  the
left  and  assigns  the  resultant  to
the variable on the left
Subtract
-
assignment operator
-=
Subtracts  the  value  on  the  right
to  the  value  of  the  variable  on
the left and assigns the resultant
to the variable on the left
Multiply
-
assignment operator
*=
Multiplies the value on the right
to  the  value  of  the  variable  on
the left and assigns the resultant
to the variable on the left
Divide - assignment
operator
/=
Divides the value on the right to
the  value  of  the  variable  on  the
left  and  assigns  the  resultant  to
the variable on the left
Modulus
-
assignment operator
%=
It takes the modulus of the LHS
and  RHS  and  assigns  the
resultant  to  the  variable  on  the
left
Left
shift
-
assignment operator
<<=
It takes the left shift of the LHS
and  RHS  and  assigns  the
resultant  to  the  variable  on  the
left


Right
shift
-
assignment operator
>>=
It  takes  the  right  shift  of  the
LHS  and  RHS  and  assigns  the
resultant  to  the  variable  on  the
left
Bitwise
-
assignment operator
&=
It  takes  the  bitwise  AND  of  the
LHS  and  RHS  and  assigns  the
resultant  to  the  variable  on  the
left
bitwise
exclusive
OR  -  assignment
operator
^=
It  takes  the  bitwise  XOR  of  the
LHS  and  RHS  and  assigns  the
resultant  to  the  variable  on  the
left
bitwise
inclusive
OR  -  assignment
operator
|=
It  takes  the  bitwise  OR  of  the
LHS  and  RHS  and  assigns  the
resultant  to  the  variable  on  the
left
Misc Operators
In addition to the above mentioned, there are several other operators, which are supported
by Java.

Download 0.82 Mb.

Do'stlaringiz bilan baham:
1   ...   18   19   20   21   22   23   24   25   ...   95




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling