//前提,dog继承了animal
Dog dog = new Dog();
Animal animal = dog;//向上类型转换
if(animal instanceof Dog){
Dog dog2 = (Dog)animal;//强制类型转换
}
慕的地8582982
洪镇海
麦克白cat
堇延未七
拖鞋_
相关分类