top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How does the XOR operator work in Java?

0 votes
350 views
How does the XOR operator work in Java?
posted Jun 8, 2016 by Karthick.c

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The XOR of two operands in java :
xorResult=One^Two , we have two operands and one operator ^(XOR) and the result of XOR of One and Two is stroed in xorResult variable.
How it works: XOR returns true(1) when both One and Two variables are different and if both are same then it returns false(0).
Sample I/O : 0=1^1, 0=0^0,1=1^0,1=0^1

answer Jun 9, 2016 by Shivam Kumar Pandey
...