Assignment Operators
Java has six types of Assignment operators:-
1. "=" Operator:- It assigns the value of the right operand to the left.
for example y=x;
here x is assigned to y .y could be any expression.
2."+=" Operator:- It adds the operands and assigns the result to the
left operand.for example x+=y.
expression can be rewritten as x=x+y.
3."-=" Operator:- It subtracts the operands and assigns the result to the
left operand.for example x-=y.
expression can be rewritten as x=x-y.
4."*=" Operator:- It multiplies the operands and assigns the result to the
left operand.for example x*=y.
expression can be rewritten as x=x*y.
5."/=" Operator:- It divides the left operands by right and assigns the result to the
left operand.for example x/=y.
expression can be rewritten as x=x/y.
6."%=" Operator:- It divides the left operand by right and assigns the remainder to the
left operand.for example x%=y.
expression can be rewritten as x=x%y.
You can assign values to more than one variable in one expression.
For Example:-
x=y=0;
Useful Links :-
Arithmetic Operators
Logical operators
Relational Operators
Conditional Operators
Bitwise Operator Intro
Bitwise Logical operator
Bitwise Left shift Operator
Bitwise Right shift Operator
Sponsored Links :-
Get Your SCJP preparation Kit free!!!!!!!
Get Your SCWCD preparation Kit free!!!
Are you Intelligent check here


















0 comments:
Post a Comment
Post a Comment