Question: how to do xnor in java?
Answer: The logical XNOR operator is == . Do you mean bitwise? if (!a ^ b) doSomething(); It gives the same result so you do not have to use brackets.