本帖最后由 王冀 于 2011-12-10 17:45 编辑
不知道你的代码书写格式是不是发上来之后才变成这样的,
class Person
{
private int age;
private String name;
private String occupation;
Person(String name)
{
this.name=name;
System.out.println(name);
}
Person(String name,int age)
{
this.name=name;
this.age=age;
System.out.println(name+"..."+gae);
}
Person(int age,String name,String occupation)
{
this(name);
this(age);
this.occupation=occupation;
System.out.println(name+"..." +age+"..."+occupation);
public void show()//很明显这个方法写在了Person(,,)内
{
this.occupation=occupation;//这个时候前边个occupation就报错了
}
} |