父类:A
子类:Person
A a1 = new Person();
if(a1 instanceof Person) {
System.out.println("true");
((Person) a1).getPersonName(); //调用子类独有的方法
}
父类:A
子类:Person
A a1 = new Person();
if(a1 instanceof Person) {
System.out.println("true");
((Person) a1).getPersonName(); //调用子类独有的方法
}
原文:http://www.cnblogs.com/paul011/p/8072796.html