The similar question was asked under What does the ^ operator do in Java?
But I think something is missing.
According to @Carl Smotricz when we have an example: "A simple way to define bitwise XOR is to say the result has a 1 in every place where the two input numbers differ."
So:
0101 ^ 0100 = 0001 (5 ^ 4 = 1)
And that is clear but what with:
15^4 based on that logic: 1111 100
should be 0111 but the compiler gives: 1011.
It does not work even if we use: Logic OR:
false || false: false
false || true: true
true || false: true
true || true: true