Why is this statement not working in java x ^= y ^= x ^= y;

Viewed 3424
int x=1;
int y=2;
x ^= y ^= x ^= y;

I am expecting the values to be swapped.But it gives x=0 and y=1. when i tried in C language it gives the correct result.

2 Answers
Related