Assignment Operator Summary : Assignment Operators « Operators « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Operators » Assignment Operators 
2.10.1.Assignment Operator Summary
Operator        Example         Result
  

=               x = 5;          x is 5.
   

+=              x = 1;          x is 6.
                x += 5;

-=              x = 1;          x is -4.
                x -= 5;

*=              x = 1;          x is 5.
                x *= 5;

/=              int x = 1;      x is 0.
                x /= 5;

%=              x = 1;          x is 1.
                x %= 5;

&=              x = 1;          x is 1.
                x &= 5;

|=              x = 1;          x is 5.
                x |= 5;

^=              x = 1;          x is 4.
                x ^= 5;

<<=             x = 1;          x is 32.
                x <<= 5;

>>=             x = 1;          x is 0.
                x >>= 5;

>>>=            x = 1;          x is 0.
                x >>>= 5;



x = y      The variable x is assigned the value of y.
x += y     The variable x is assigned the value of x + y.
x -= y     The variable x is assigned the value of x - y.
x *= y     The variable x is assigned the value of x * y.
x /= y     The variable x is assigned the value of x / y.
x %= y     The variable x is assigned the value of x % y.
x &= y     The variable x is assigned the value of x & y.
x |= y     The variable x is assigned the value of x | y.
x ^= y     The variable x is assigned the value of x ^ y.
x <<= y    The variable x is assigned the value of x <<= y.
x >>= y    The variable x is assigned the value of x >>= y.
x >>>= y   The variable x is assigned the value of x >>>= y.
2.10.Assignment Operators
2.10.1.Assignment Operator Summary
2.10.2.Compound Assignment Operators
2.10.3.An arithmetic operator with = perform an operation on the variable on the left side and store the results in the variable.
2.10.4.a = b = c is evaluated as a = (b = c).
2.10.5.Simple assignment uses =
2.10.6.Assignment operators include an implicit cast.
2.10.7.Java uses the + and += operators to indicate concatenation for string values.
2.10.8.compound additive operator (+=) and Strings
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.