It is performing a bitwise or, based on your expecting output – I believe you wanted a xor. Like,
int a = (4 ^ 6);
outputs
2
solved Explain me ,binary | dont work (java)
It is performing a bitwise or, based on your expecting output – I believe you wanted a xor. Like,
int a = (4 ^ 6);
outputs
2
solved Explain me ,binary | dont work (java)