public class test {
public static void main(String[] args) {
char c = 'Q';
int j = c;
System.out.println(j + " " + c);
}
}
The above code outputs 81 Q, but I thought Q is 51 in Unicode? what’s happening?!
51 is hexadecimal for 81 (5*16 + 1 = 81). Q is 81 in decimal, 0x51 in hex, U+0051 in Unicode, which are all the same thing.
See for example the entry for Q on this page.