Can anyone explain the use of ^ operator in java with some examples?Thanks
+15
A:
This is the same as ^ in most languages, just an XOR.
0 ^ 0 == 0
1 ^ 0 == 1
0 ^ 1 == 1
1 ^ 1 == 0
Cody Brocious
2009-01-20 09:13:03
Well, not _any_ language - VB uses ^ for exponentiation.
gkrogers
2009-01-20 09:15:09
Yes but VB always uses different stuff anyway... ;)
LePad
2009-10-11 23:38:45
+4
A:
That's the bitwise exclusive OR operation. Check out the Bitwise and Bit Shift Operators section of the Java tutorials for more information.
Zach Scrivena
2009-01-20 09:16:03
+4
A:
In java ^ operator used for bitwise XOR operation.
Follow this link to see the operator precedence also.
BlackPanther
2009-01-20 09:25:30