+ 1
NOTE: The 3 expressions need to be wrapped in parentheses before the code can run. Edited as follows:
System.out.print ((i ^= 3) + " " + (i &= 3) + " " + (i |= 3));
~~~
i = 2
i ^= 3 equivalent to i = i ^ 3 equivalent to i = 2 ^ 3
0010 (2)
0011 (3)
-------------- ^ (XOR)
0001 (1)
* XOR operator yields 1 when two operands' value are different
* Now <i> is 1 ...
i &= 3 equivalent to i = i & 3 equivalent to i = 1 & 3
0001 (1)
0011 (3)
-------------- & (AND)
0001 (1)
* AND operator yields 1 if both operand are 1
* <i> is again 1 ...
i |= 3 equivalent to i = i | 3 equivalent i = 1 | 3
0001 (1)
0011 (3)
-------------- | (OR)
0011 (3)
* OR operator yields 1 when either operands' was 1
* <i> is now 3 ...
(Edited)



