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,菜鸟一枚
相关分类