q1] - No it is not valid (as you would know if you tried to compile it). The reason is that to declare a variable you need to use a keyword, not something that will look like a keyword AFTER the compiler translates it. By the way you stuck a null in the middle of char, I think you meant to stick an 'a' like
ch'\u0061'r x = 'a'; (which won't work either).
q2] In 2 the char is getting a decimal code for a. I looked this up in my ooooold IBM extended architecture pamplet.
Dec 65 corresponds to hex 41 corresponds to ASCII 'A' corresponds to unicode \u0041.
Dec 97 = hex 61 - ASCII 'a' = unicode \u0061.
So the answer is NO, A !== 65.
q3] Yes it must be lower case. Otherwise the compiler takes the whole thing as a literal and can not squeeze it into a char.
q4] \u0065 is unicode for 'e'. 0x0065 is hex for 'e'. The compiler resolves them and sees them as equal.
Try it!!!
class Test{
public static void main(
String args[])
{
//ch'u\0061'r p = 'u'; not a keyword
//char q = '\U0065'; not proper unicode
char a = 65; // uses Dec code assignment
System.out.println("a = " + a);
char x = 41;
System.out.println("x= " + x);
char y = '\u0065';
long z = 0x0065;
boolean b = (y == z);
System.out.println("y = " + y + ", z = " + z + " " + b );
}
}
[This message has been edited by Cindy Glass (edited December 20, 2000).]