java数据类型
- 基本类型
- 整数类型
byte[1] short[2] int[4] long[8] - 布尔类型
boolean[1] - 浮点类型
double[8] float[4] - 字符型
char[2]
- 整数类型
- 引用类型
- 类(class)
- 接口(interface)
- 数组([])
低精度向高精度
char->int->long->float->double
byte->short->int->long->float->double
多种类型的数据混合运算时,系统首先将数据转换成容量最大的那种类型
int n1 = 10;
- [ x ] float n2 = n1 + 1.1;
- [ √ ] double n3 = n1 + 1.1;
- [ √ ] float n3 = n1 + 1.1f;
a++ 先取值后运算
++a 先运算后取值
Java的数据类型包括基本类型和引用类型,如整数类型(byte,short,int,long)、浮点类型(float,double)、布尔类型(boolean)和字符型(char)。在运算中,系统会将数据转换为最大容量的类型。例如,int与float或double混合运算时,会提升到float或double类型。此外,自增运算符(++)有不同的顺序影响。

被折叠的 条评论
为什么被折叠?



