-1

Java programming.

int i = 0;
int j = 1;
str.charAt(i) ^ str2.charAt(j) 

What does mean ^ operator in java? And what is this operator reverse operation? example w ^ . = 121 T ^ W = 35

2 Answers2

4

The bitwise ^ operator performs a bitwise exclusive OR operation.

Applied, this does:

false ^ false = false
false ^ true = true
true ^ false = true
true ^ true = false

When it comes to integer varibles (including the type char) the numbers are converted to their binary representation and then the operator takes place. For example:

3 ^ 5 = 011 ^ 101 = 110 = 6
Konstantin Yovkov
  • 62,134
  • 8
  • 100
  • 147
0

^ indicates Binary XOR Operator copies the bit if it is set in one operand but not both.

Truth Table For XOR

enter image description here

Rakesh KR
  • 6,357
  • 5
  • 40
  • 55