qq_慕侠9518479
2019-07-25 12:12
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 { public static void main(String[] args) { Animal animal = new Animal(); System.out.println("animal age:"+animal.age);//最终执行的语句都要放在main方法中 Dog dog = new Dog(); dog.age = 10; dog.name = "xiaotian"; dog.eat(); } }
Java入门第二季 升级版
530560 学习 · 6091 问题
相似问题