求助啊
class Person
{
private String name;
private int age;
Person()
{
System.out.println("A"+"name="+name+",,age="+age);
speak();
}
Person(String b)
{
System.out.println("A"+"name="+name+",,age="+age);
speak();
}
public void setName(String n)
{
name=n;
}
public String getName()
{
return name;
}
Person(String n,int c)
{
name=n;
age=c;
System.out.println("C"+"name="+name+",,age="+age);
speak();
}
void speak()
{
System.out.println("cay...............");
}
}
class PersonDemo1
{
public static void main(String[] args)
{
//Person p=new Person();
Person p1=new Person("大黄");
System.out.println(p1.getName);
//Person p2=new Person("阿凯",28);
//p.speak();
//p.speak();
}
}
|