public class StudentPaper { //父类的member 成员变量应该protected 不应该是private protected String studentanswer;
public String getStudentanswer() { return studentanswer; }
public void setStudentanswer(String studentanswer) { this.studentanswer = studentanswer; }
}
public class StudentPaper {
private String studentanswer;
public String getStudentanswer() { return studentanswer; }
public void setStudentanswer(String studentanswer) { this.studentanswer = studentanswer; }
}
public static void main(String[] args) throws Exception { StudentPaper s = new StudentPaper(); s.setStudentanswer("学员的回答"); Answer a = new Answer(); a.fatherToChild(s,a); System.out.println(a.toString());