instanceof:用于判断一个对象是否是另一个对象,是否is-a关系?前面的引用变量应该属于背面的类是,继续或举行了接口实现。好比一个父类对象引用指向了一个子类,如Person person = new Student();,那么 person instanceof Student 是true,因为person对象虽然是父类,但是实际上指向子类,以是其是子类的instance,假如其指向父类,判断就会返回falsePerson person = new Person();,person instanceof Student。