| 123456789101112131415161718 |
- package course.polymorphism;
- /**
- * @author WanJl
- * @version 1.0
- * @title Test01
- * @description
- * @create 2026/7/24
- */
- public class Test01 {
- public static void main(String[] args) {
- //多态---父类的引用指向子类的对象
- Animal animal=new Dog();
- animal.eat();
- animal.sleep();
- }
- }
|