随笔分类 -  个人笔记

Java super关键字使用及内存图
摘要:示例1: public class SuperTest{ public static void main(String[] args){ Vip v = new Vip("zhang"); v.shopping(); } } class Customer{ String name; public C 阅读全文
posted @ 2021-01-04 21:59 homle 阅读(332) 评论(0) 推荐(0)
Java 多态和instanceof的使用
摘要:先创建一个父类Animal类: public class Animal{ public void move(){ System.out.println("动物可以移动"); } } 创建子类Cat类: public class Cat extends Animal{ public void move 阅读全文
posted @ 2021-01-03 11:16 homle 阅读(398) 评论(0) 推荐(0)
Java 方法覆盖
摘要:方法覆盖示例: public class OverrideTest01{ public static void main(String[] args){ //ChinaPeople cp = new ChinaPeople("张三"); //错误: 子类无法继承父类的构造方法; ChinaPeopl 阅读全文
posted @ 2021-01-02 16:51 homle