自动类型转换:类型范围小的变量自动复制转换类型大的变量。
例如:
byte a=1;
int b=a;
System.out.println(a);
System.out.println(b);
流程图
byte->short->int->long->float->double
表达式中 类型转换是由最高类型来决定
byte a =12;
int b=13;
int c=a+b
a+b 只能用int或者比int范围更高的类陷来接受。
强制类型转换
int a="12";
byte b=(byte) a;