强制类型转换
public class HelloWorld{
public static void main(String[] args) {
double heightAvg1=176.2;
int heightAvg2=(int)heightAvg1;
System.out.println(heightAvg1);
System.out.println(heightAvg2);
}
}
在强制类型转换中为什么用的是int heightAvg2=(int)heightAvg1;
而不是int heightAvg2=(double)heightAvg1;