package com.oop.demo06; public class Person { public void run() { System.out.println("run"); } } package com.oop.demo06; public class Student extends Person { public void go() { System.out.println("go"); } } /* 多态注意事项: 1.多态是方法的多态,属性没有多态 2.父类和子类,有联系 类型转换异常! ClassCastException ! 3.存在的条件:继承关系,方法需要重写,父类引用指向子类对象! Father f1 = new Son(); 不能被重写的情况: 1. static 方法,属于类,它不属于实例 2. final 常量; 3. private 方法; */ /* //Object > String //Object > Person > Student //Object > Person > Teacher Object object = new Student(); //System.out.println(x instanceof y);能不能编译通过 System.out.println(object instanceof Student); System.out.println(object instanceof Person); System.out.println(object instanceof Object); System.out.println(object ins