// 数据类型
// 分类:
// 基本类型:8种
// 引用类型:类、接口、数组
// 基本类型:
// 整型:byte、short、int(-128-127)、long、
// 浮点型:float(单精度)、double(双精度)
// 字符型:char
// 布尔值:boolean
// byte
byte b1 = 127;
// short
short s1 = -32768;
// int
int a = 2022222222;
// long
long l = 2000L;
// float
float f = 2.3f;
// double
double d = 0.2;
// char
char c = 'c';
// boolean
boolean b = true;
// 字符类型在参与运算时,会转换成相应的ASCILL值
int i2 = c + 23;
System.out.println(i2);
// 引用类型
String str = "hello";
java——数据类型
最新推荐文章于 2021-09-18 23:45:43 发布