Q: If b is 9 and c is 2, what is the value of b ^= c after the expression is executed in Java?
D
Answer:
D
Explanation:
The bitwise XOR assignment operator (^=) in Java performs a bitwise XOR operation between the variable on the left-hand side and the value on the right-hand side and assigns the result to the variable. In this case, b ^= c is equivalent to 00001001 ^ 00000010, resulting in 00001011, which is 11 in decimal.
Related Topic:
Share Above MCQ