变量类型
1.整型
1) byte;字节;1字节
2)short;短整型;2字节
3)int;整型;4字节
4)long;长整型;8字节
2.浮点型
1)float ;浮点数;4字节
2)double;双精度浮点数;8字节
3.字符型
1)char;字符;2字节
4.布尔型
1)boolean ;布尔型;
boolean 类型表示 “是”,“否”二选一的值。 boolean a=true; boolean b=false;
布尔类型的值为:true 或 false
声明变量:
1)数据类型 变量名;
int type;
boolean flag;
float score;
2)数据类型 变量名 =数值;
int box=100;
int a=300;
boolean f=true;
变量
最新推荐文章于 2023-03-26 23:01:05 发布