OK.
public static void Main (string[] args) {
char c= ' Lee ';
System.out.println (c);
String s= "Week";
System.out.println (s);
}
Li
Zhou
String stores Chinese characters well understood, how char stores Chinese characters.
Char is stored by character, in English or Chinese, and is used for 2 bytes, storing Unicode characters. Range in 0-65536. The Unicode encoding character set contains Chinese characters, so it is possible to store Chinese characters in char variables. However, if a particular character is not is included in the Unicode encoding character set, this particular character cannot be stored in this char variable. If you use 3 bytes with a lot of infrequently used words and take up a lot of unnecessary storage space, we use 2 bytes instead of 1 or 3 to represent the International Code of the Chinese character. Supplementary Note: 1. Unicode encoding is fixed to occupy two bytes, so variables of type char are also occupied by two bytes. Unicode (Unified code, Universal code, Single code) is a character encoding that is used on a computer. It sets a uniform and unique binary encoding for each character in each language, To meet the requirements of text conversion and processing across languages and platforms. The disadvantages of traditional coding methods are: ① may correspond to different letters under different coding schemes. ② languages with large character sets may have different encoding lengths The current version of Unicode for practical use corresponds to UCS-2, using 16-bit encoded space. That is, each character occupies 2 bytes. 2. Different looking coding occupies the same number of bytes: utf-32 Chinese is 4 bytes; Utf-8 code in Chinese is 3 bytes, the letter is 1 bytes, because utf-8 is variable length encoding; And gbk/gbk18030 Chinese is 2 bytes, English is 1 bytes. |