+ 2
How to use a xor operation in Java?
8 Respostas
+ 2
I think its a^b
+ 2
As I said the operator is^.
so bolean a=true;
boolean b=true;
boolean c=a^b;
//false
+ 1
At first glance I would say with the statement
if (!(a&&b)¦¦((!a)&&(!b)))
Because the xor is false if A end B are the same so we check either if they are both true or if they are both false.
+ 1
It just works when , one of options is false and other is true ..
Like ..
If ( i'm 10 && i have money )
I will buy a car ..
It's working cuz i'm 21 not 10 !
+ 1
thank u captain Flint😃😃
+ 1
x^y
+ 1
yes we can use xor just like boolean operators
0
I know the logic. but I just wanted to know which operator can be used to perform XOR operation..