class Person
{
private String name;
private int age;
Person()
{
System.out.println("A:name="+name+",,age="+age);
}
Person(String n)
{
name = n;
System.out.println("B:name="+name+",,age="+age);
}
Person(String n,int a)
{
name = n;
age = a;
System.out.println("C:name="+name+",,age="+age);
}
}
class Person2
{
public static void main(String[] args)
{
Person p1 = new Person();
Person p2 = new Person("lisi");
}
}
提示person类里缺少主函数= =什么鬼 |