package scjp;
class Parent{
}
public class Demo57 extends Parent{
public static void main(String[] args) {
Demo57 demo57=new Demo57();
if (demo57 instanceof Parent) {
System.out.println("demo57 is the instance of Parent");
}
}
}
输出为demo57 is the instance of Parent,说明子类是父类的实例.instanceof返回的是true