class Person{ int age = 12; static String name = "lili"; Person() { name = "baby"; age = 1; System.out.println("person run"); } Person(String name) { this(); this.name = name; } public static void show() { System.out.println(name+":"); }}class Test{ public static void main(String[] args) { Person p = new Person(); p.show(); System.out.println( Person.name); Person.show(); }}我认为输出的结果应该是baby lili lili;可是结果是baby baby baby;哪位哥哥姐姐可以帮忙解答一下。本人正在学java,菜鸟一枚
添加回答
举报
0/150
提交
取消