为什么3-4继承顺序中老师代码可以运行而我的不可以
public class Initail { Animal animal = new Animal(); System.out.println("animal age:"+animal.age); public static void main(String[] args) { Dog dog = new Dog(); dog.age = 10; dog.name = "xiaotian"; dog.eat(); } }
public class Initail { Animal animal = new Animal(); System.out.println("animal age:"+animal.age); public static void main(String[] args) { Dog dog = new Dog(); dog.age = 10; dog.name = "xiaotian"; dog.eat(); } }
2019-07-25
举报