请问这哪里出问题了
package chapter4;
public class Initail02 {
public static void main(String[] args) {
Dog02 dog=new Dog02();
Animal02 animal=dog; //自动类型提升 向上类型转换
Dog02 dog2=(Dog)animal;//向下类型转换 强制类型转换
Cat cat=animal;
}
}
package chapter4;
public class Initail02 {
public static void main(String[] args) {
Dog02 dog=new Dog02();
Animal02 animal=dog; //自动类型提升 向上类型转换
Dog02 dog2=(Dog)animal;//向下类型转换 强制类型转换
Cat cat=animal;
}
}
2017-09-30
举报