| Author |
XOR operator
|
podonga poron
Ranch Hand
Joined: May 12, 2008
Posts: 55
|
|
class XOR_operator { public static void main(String[] args) { System.out.println("xor " + ((true) ^ (true))); } } Result = False ??? WTF .. how this operator works ? thanks !
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
The "x" in "xor" means "exclusive." So a^b is true if a is true or b is true, but not if both are true (because then it wouldn't be exclusive). Or as JLS - 15.22.2 puts it, "the result value is true if the operand values are different; otherwise, the result is false." [ June 05, 2008: Message edited by: marc weber ]
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
podonga poron
Ranch Hand
Joined: May 12, 2008
Posts: 55
|
|
|
thanks ! is clear now
|
 |
 |
|
|
subject: XOR operator
|
|
|