Friday, February 20, 2009

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:

About This Blog

This Blog is all about Java and programming.This blog is written by Vaibhav Pandey .He is a Computer Science Graduate .You can contact the author at javatute@gmail.com for any suggestion or Query.You can also contact the author for advertising on this blog.All the material presented here is the property of author and its reproduction in any form is strictly prohibited.

Disclaimer:-Download links provided here are not of author in any means.These are found over the Internet.
Page copy protected against web site content infringement by Copyscape

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP