用instanceof类型转换是不是只能转换一个对象?
Jiaoche jiaoche = new Jiaoche();
feiji plane = new feiji();
Jiaotonggongju jiaotonggongju = jiaoche;
if(jiaotonggongju instanceof feiji) {
feiji plane2 = (feiji) jiaotonggongju;
}else {
System.out.println("123");
}
if(jiaotonggongju instanceof Jiaoche) {
Jiaoche jiaoche2 = (Jiaoche)jiaotonggongju;}
else {System.out.println("321");}
这样子只能转换Jiaoche,feiji就转换不了了,当我两种都转换的时候就报错了