public class Test {
public static void main(String[] args) {
//instanceof 父类子类
Father father1 = new Father();
System.out.println(father1 instanceof Father ); //ture
System.out.println(father1 instanceof Son ); //false
Father father2 = new Son();
System.out.println(father2 instanceof Father ); //ture
System.out.println(father2 instanceof Son ); //ture
Son son = new Son();
System.out.println(son instanceof Father ); //ture
System.out.println(son instanceof Son ); //ture
}
}