上
- 不能对布尔类型进行转换
- 不能转换成不相干的类型
- 大类型转小类型为强制转换
- 转换可能会内存溢出,影响精度
- 数字间可以下划线隔开
public class Day02 {
public static void main(String[] args) {
int i=128;
byte b=(byte)i;
System.out.println(b);
int c=10_0000_0000;
System.out.println(c);
int d=20;
int e=c*d;
System.out.println(e);
long f=c*d;
System.out.println(f);
long g=c*(long)d;
System.out.println(g);
System.out.println("============================");
System.out.println("1. 不能对布尔类型进行转换\n
2. 不能转换成不相干的类型\n
3. 大类型转小类型为强制转换\n
4. 转换可能会内存溢出,影响精度\n
5. 数字间可以下划线隔开");
}
}