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.
Do'stlaringiz bilan baham: