十一、instanceof和类型转换

public class Demo02 {       public static void main(String[] args) {         //Object>Person>Student         //Object>Person>Teacher         //Object>String         Object object = new Student();         System.out.println(object instanceof Student);         System.out.println(object instanceof Person);         System.out.println(object instanceof Object);         System.out.println(object instanceof Teacher);         System.out.println(object instanceof String);          System.out.println(=======================);         Person person = new Student();         System.out.println(person instanceof Student);         System.out.println(person instanceof Person);         System.out.println(person instanceof Object);         System.out.println(person instanceof Teacher);         //System.out.println(person instanceof String);//编译报错          System.out.println(=======================);          Student student = new Student();         System.out.println(student instanceof Student);         System.out.println(student instanceof Person);         System.out.println(student instanceof Object);          //System.out.println(student instanceof Teacher);//编译报错         //System.out.println(person instanceof String);//编译报错     } }