JavaSE基础(二)

数据类型

基本数据类型 (8个)

整型 byte short int long
浮点型 float double
字符型 char
布尔型 blooean

引用数据类型

数组  []array
类    class(抽象类 abstract class)
接口  interface  
枚举  enum
注解  @interface

byte 字节型

1 byte = 8 bit   00000000   256种组合
用第一个bit的位置记录符号 0表示正数 1表示负数
数值的范围2的-7次方到二的7次方减1
-128~127

以上其他整数类型依次乘2

short  2字节  16bit
int    4字节  32bit
long   8字节  64bit

浮点型

float  4字节  32bit
double 8字节  64bit

字符型

'a' '+' '我' ‘5’
英文符号和数字是1字节   采用ASCII  美国信息交换标准代码 由字母 数字 符号组成
中文是2字节    unicode编码

布尔型

boolean  1bit
true  false