容量从低到高: byte short int long float double
低转高 自动转换 高转低 强制转换
强制转换需考虑到数值范围以及精度 不能把对象类型转化为不相干的类型
// 内存溢出 long l = 10000000000L; int i = (int) l; System.out.println(i); // 1410065408
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3