1, different data types
Bytes? Is it a byte data type? , which is symbolic, can mean-128- 127? Number of;
Charles? Is it a character data type? Is unsigned and can represent integers, but not negative numbers.
Usage example:
Charles? Me? =? 85; //U corresponds to ASCII 85.
Bytes? d3? =? 127; ? //? What if it's byte d3? =? 128; Will you report an error?
Bytes? d4? =? - 128; ? //? What if it's byte d4? =? - 129; An error will be reported
2. The size and scope of the occupied space are different.
Bytes account for 1? Bytes; The size range is-128-127;
Char takes up 2 bytes (Unicode code? ); Size range? Is it 0-65535? ; Char is 16 binary Unicode character, and JAVA uses char to represent a character? .
In addition, char can represent Chinese characters, but byte can't. Usage example:
Charles? e 1? =? Medium'? e2? =? Country'; ?
Bytes? f=? (bytes)? Medium'; ? //You must cast or report an error.
References:
Baidu encyclopedia -char
References:
Baidu encyclopedia-bytes