笔试题:判断
1。Java char类型 以UTF-16 Big Endian 的方式保存一个字符  
2。java字符编码中每个中文占2个字节,每个英文占1个字节

解决方案 »

  1.   

    Java virtual machine always used big-endian, Intel x86 used little-endian. A String represents a string in the UTF-16 format in which supplementary characters are represented by surrogate pairs (see the section Unicode Character Representations in the Character class for more information). Index values refer to char code units, so a supplementary character uses two positions in a String. The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. 
      

  2.   

    1。Java char类型 以UTF-16 Big Endian 的方式保存一个字符  
    正确
    2。java字符编码中每个中文占2个字节,每个英文占1个字节
    错误,中文和英文都是用UTF-16存储,所以都占两个字节!