class Test7
{
private String name;
private int age;
private String sex;
//添加构造方法,就没错了,类名我改成Test7了 注意
public Test7(String name, int age, String sex){}
void Test3(String name,int age,String sex)
{
this.name=name;
this.age=age;
this.sex=sex;
}
void print()
{
System.out.println(name);
System.out.println(age);
System.out.println(sex);
}
public static void main(String[] args)
{
Test7 t7 = new Test7("zhangsan",20,"男");
t7.print();
}
} |