How to use a xor operation in Java? | Sololearn: Learn to code for FREE!
+ 2

# How to use a xor operation in Java?

25th Jul 2016, 1:18 PM
mahi
8 ответов
+ 2
I think its a^b
26th Jul 2016, 2:59 PM
No One
+ 2
As I said the operator is^. so bolean a=true; boolean b=true; boolean c=a^b; //false
27th Jul 2016, 4:45 AM
No One
+ 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.
25th Jul 2016, 3:14 PM
Valentino Picone
+ 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 !
27th Jul 2016, 12:42 AM
dzhwar
+ 1
thank u captain Flint😃😃
27th Jul 2016, 5:40 AM
mahi
+ 1
x^y
28th Jul 2016, 6:04 PM
jay kalariya
+ 1
yes we can use xor just like boolean operators
1st Aug 2016, 5:16 PM
Vimal kumar
0
I know the logic. but I just wanted to know which operator can be used to perform XOR operation..
27th Jul 2016, 4:34 AM
mahi
Актуальное сегодня
Hi I am new