new的时候调用构造函数出现错误。。
代码如下,在new的时候调用构造函数出现了个错误,本人实在找不出,求指导。。class Person {
String name;
char sex;
String id;
String phone;
String email;
Person(String name, char sex, String id) {
this.name = name;
this.sex = sex;
this.id = id;
}
void setId(String id) {
this.id = id;
}
void setEmail(String email) {
this.email = email;
}
void setPhone(String phone) {
this.phone = phone;
}
public String toString() {
return "姓名: "+name+"\n"+"性别: "+sex+"\n"+"身份证号: "+id+"\n"+"联系电话: "+phone+"\n"+"E-mail地址: "+email+"\n";
}
}
class Student extends Person {
long sNo;
String sClass;
Student(String name, char sex, String id, long sNo){
super(name, sex, id);
this.sNo = sNo;
}
void setSclass(String sClass) {
this.sClass = sClass;
}
public String toString() {
return super.toString()+"学号: "+"sNo"+"\n"+"班级: "+sClass+"\n";
}
}
public class TestStudent {
public static void main(String[] args) {
Student aStudent = new Student("杨过", "男", "22033198807070333", 2004002L);
aStudent.setEmail("haict@);
aStudent.setPhone("610000");
aStudent.setSclass("软件3班");
System.out.println(aStudent.toString());
}
}