Many beginners may be confused about the two data types char and byte. Today, I have checked a lot of information and summarized and compared the two data types byte and char, first, share the results with you: byte is a byte data type, which is signed and occupies 1 byte. The size range is-128-127. Char is a character data type, unsigned, occupies 2 bytes (Unicode Code); the size range is 0-65535; char is a 16-bit binary Unicode character, JAVA uses char to represent a character. The following example compares the differences between the two: 1. Char is unsigned and can represent an integer rather than a negative number. byte is signed, it can represent the number of-128-127; for example, [html] char c = (char)-3; // char cannot recognize negative numbers and must be forcibly converted; otherwise, an error is returned, system cannot be recognized even after forced conversion. out. println (c); byte d1 = 1; byte d2 =-1; byte d3 = 127; // if it is byte d3 = 128; the system reports an error of byte d4 =-128; // if it is byte d4 =-129, an error is returned. out. println (d1); System. out. println (d2); System. out. println (d3); System. out. println (d4); Result :? 1-1127-1282. char can contain Chinese characters, but byte cannot. For example, [html] char e1 = '中', e2 = 'guo'; byte f = (byte) '中'; // must be forcibly converted; otherwise, System is reported. out. println (e1); System. out. println (e2); System. out. println (f); the result is: Chinese 453, char, byte, int for English characters, can be converted to each other, such as: [html] www.2cto. combyte g = 'B'; // the ASCII value of B is 98 char h = (char) g; char I = 85; // U corresponds to ASCII 85 int j = 'H'; // h corresponds to ASCII 104 System. out. println (g); System. out. println (h); System. out. println (I); System. out. println (j); Result: 98bU104