public class charTest { public static void main(String[] pars) { char ch = 'a'; long l = 0; int i = 0; byte b = 0; short s = 0; l = ch; i = ch; s = ch; // Doesn't compile, loss of precision b = ch; // Doesn't compile, loss of precision s = (short)ch; b = (byte)ch; ch = l; // Doesn't compile, loss of precision ch = i; // Doesn't compile, loss of precision ch = s; // Doesn't compile, loss of precision ch = b; // Doesn't compile, loss of precision ch = (char)l; ch = (char)i; ch = (char)s; ch = (char)b; ch = '\u0041'; // 41 in hex is 65 decimal, which is 'A' System.out.println(ch); System.out.println('\u0007'); // 07 in hex rings the bell ch = 65; System.out.println(ch); b = (byte)ch; System.out.println(b); ch = (char)b; System.out.println(ch); } }