1、整型默认int
byte a = 1;
short b = 2;
int c = 3;
long d = 4;
// 高字节转低字节,低字节“装不下”,强转!!!
byte aa = (byte)b;
short bb = (short)c;
int cc = (int)d;
// 低字节转高字节,高字节“装得下”,自转!!!
long d1 = c;
int c1 = b;
int b1 = a;
2、浮点型默认double
float c = 2.9f;
double d = 2.0;
// 低字节转高字节,自转!
double d1 = c;
// 高字节转低字节,强转!
float f1 = (float) d;
3、浮点vs整型
// 整型自动转为浮点
int w0 = 1;
float w1 = w0;
double w2 = w0;
// 浮点强转为整型
int q1 = (int) w1;
int q2 = (int) w2;