you can assign a number literal, assuming it will fit into the unsigned 16-bit range (65535 or less).
public class MainClass{
public static void main(String[] argv){
char a = 0x892; // hexadecimal literal
char b = 982; // int literal
char c = (char)70000; // The cast is required; 70000 is
// out of char range
char d = (char) -98; // Ridiculous, but legal
}
}
|