摘要: public static void main(String[] args) { //类型之间的转换 父 到 子 高 到 低 Person person = new Student(); //student这个对象装换为Student类型,我们就可以使用Student类型的方法了 Student s 阅读全文
posted @ 2020-07-08 22:30 光光1234 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 多态注意事项: 1.多态是方法的多态,属性没有多态 2.父类和子类有联系,类型转换异常!ClassCastException! 3.存在的条件:继承关系,方法需要重写 父类引用指向子类对象! Father S1 = new Son(); 1.static方法不能重写 2.final 常量 不能重写 阅读全文
posted @ 2020-07-08 09:15 光光1234 阅读(125) 评论(0) 推荐(0) 编辑