^ operator in java

Warrior picture Warrior · Jan 20, 2009 · Viewed 55.3k times · Source

Can anyone explain the use of ^ operator in java with some examples?

Answer

Serafina Brocious picture Serafina Brocious · Jan 20, 2009

This is the same as ^ in most languages, just an XOR.

false ^ false == false
true ^ false == true
false ^ true == true
true ^ true == false