Q:

xor operation between chars

I have the following piece of Java code and while debugging in Eclipse, Windows 7, the variable 'xoredChar'  shows no value at all, not null, not '', nothing.
char xoredChar = (char) (stringA.charAt(j)^stringB.charAt(j));

Why is that? I need to understand how can I do this xor operation between two characters in java. What am I missing?

A:

Well, if the strings are equal you'll get back a \0 which is not a printable character. Try something like this,
String stringA = "A";
String stringB = "A";
int j = 0;
char xoredChar = (char) (stringA.charAt(j) ^ stringB.charAt(j));
System.out.printf("'%c' = %d\n", xoredChar, (int) xoredChar);

Output is
' ' = 0

