class A{
public void fun1(){
System.out.println("A类对象");
}
public void fun2(){
this.fun1();
}
}
class B extends A{
public void fun1(){
System.out.println("B类中的实例");
}
public void fun3(){
System.out.println("B类中3的实例");
}
}
class C extends A{
public void fun1(){
System.out.println("C类中的实例");
}
public void fun4(){
System.out.println("C类中的4实例");
}
}
class DTest4{
public static void main(String args[]){
fun(new A());
fun(new B());
fun(new C());
}
public static void fun(A a){
a.fun2();
if(a instanceof B){
B b =(B)a;
b.fun3();
}
if(a instanceof C){
C c = (C)a;
c.fun4();
}
}
}
他是怎么运行的