JAVA中有八种基本类型

  • 对于整数有4种类型:byte, short, int, long
  • 实数类型: float, double
  • 字符类型: char
  • 布尔: 返回 true 或 false 值 (true 或 false)
  • 类型 描述 bit 最小值 最大值
    byte
    8位整数
    8  -128 (-2^7) 127 (2^7-1)
    short
    16位整数
    16 -32,768 (-2^15) 32,767 (2^15 -1)
    int
    32位整数
    32 - 2,147,483,648
    (-2^31)
    2,147,483,647
    (2^31 -1)
    long
    64位整数
    64 -9,223,372,036,854,775,808
    (-2^63)
    9,223,372,036,854,775,807
    (2^63 -1)
    float
    32位实数
    32 -3.4028235 x 10^38 3.4028235 x 10^38
    double
    64位实数
    64 -1.7976931348623157 x 10^308 1.7976931348623157 x 10^308
    boolean
    逻辑类型
     
    false true
    char
    字符
    16 '\u0000' (0) '\uffff' (65,535).

猜你喜欢

转载自lambertsprite.iteye.com/blog/2293830
今日推荐