byte b = 0;
int i = 258;
double d = 323.942;
b = (byte) i; //byte 转 int 取int%256的值,取余数
System.out.println(b);
i = (int) d; //double 转 int 直接舍弃小数部分,不会有四舍五入现象
System.out.println(i);
b = (byte) d;
System.out.println(b); //double 转 byte 取double%256的值,取余数
System.out.println((byte)d%256); //是这种操作
//表达式类型自动提升
float f = 30000.14f;
float fResult = f*f; //类型没有自动提升
double dResult = f*d; //类型自动提升至double
i = b+b; //类型自动提升至int
f = f * b; //类型提升至了float
short s = 33;
char c = 64;
i = s+s; //类型自动提升
i = c+c; //类型自动提升
System.out.println(fResult);
System.out.println(-9/-3);