问一下byte 和 char 的区别

解决方案 »

  1.   

    ...数据类型基本类型有以下四种:
    int长度数据类型有:byte(8bits)、short(16bits)、int(32bits)、long(64bits)、
    float长度数据类型有:单精度(32bits float)、双精度(64bits double)
    boolean类型变量的取值有:ture、false
    char数据类型有:unicode字符,16位
    对应的类类型:Integer、Float、Boolean、Character、Double、Short、Byte、Long
      

  2.   

    byte是字节
    Char一个字符
    但也都是基本类型
      

  3.   

    1:表现形式 byte b=100; char c1='c'; char c2='中';
    2:值域范围: byte: -2^8+1~2^8  char:0~2^16
      

  4.   

    相同点:
           两个都是基本类型;
           在(-128-127)范围内,byte,char,int 类型的数据可相互赋值
    不同点:
        byte 类型 占一个字节数(-128-127)
        char 类形 占两个字节数(-35768--35767)
      

  5.   

    byte 占8位,char 占16位,等同于int
      

  6.   

    to: andybogardint 占 4 个字节 32 位,不等同于 char。