public class TestTypeAutoConvert{
public static void main(String []args) {
//容量小的类型可以自动转换成容量大的类型
int a = 2345;
long b = a;
int c = b;//long类型不能转换成int类型
System.out.println(c)
}
//特例 整型常量int可以转换成byte char short 类型 只要不超过对应类型的表达范围
//比如byte h1 = 123;//byte h2 = 1234;不可取
}
public class TestTypeAutoConvert{
public static void main(String []args) {
//容量小的类型可以自动转换成容量大的类型
int a = 2345;
long b = a;
int c = b;//long类型不能转换成int类型
System.out.println(c)
}
//特例 整型常量int可以转换成byte char short 类型 只要不超过对应类型的表达范围
//比如byte h1 = 123;//byte h2 = 1234;不可取
}