Classes/Objects  «Prev 


Java operators

Assignment operators in Java

Operator Example Result
= x = 7; x is 7
+= x = 7; x += 4; x is 11
-= x = 7; x -= 5; x is 2
*= x = 7; x *= 5; x is 35
/= int x = 7; x /= 5; x is 1
%= x = 7; x %= 5; x is 2
&= x = 7; x &= 5; x is 5
|= x = 7; x |= 5; x is 7
^= x = 7; x ^= 5; x is 2
<<= x = 7; x <<= 2; x is 28
>>= x = 7; x >>= 2; x is 1
>>>= x = 7; x >>>= 1; x is 3