如何在新方法中将对象作为参数传递?

时间:2016-05-07 22:08:25

标签: java

好的......我现在这是一个愚蠢的问题,但我正在努力解决这个问题。

public class University {

private List<Student> students;

public University() {
    this.student = new ArrayList();
}

public void loadFile(String fileStudents) throws  IOException {
    BufferedReader readStudents = new BufferedReader(new FileReader(fileStudents));
    while(true){
        String line = readStudents.readLine();
        if( line == null)
            break;
        String fields[] = line.split(":");

        Student e = new Student(Long.parseLong(fields[0]),fields[1], fields[2]);
        //System.out.println(e);
        students.add(e);
    }

}

public List<Student> getStudents() {
    return students;
}

public void setStudents(List<Student> students) {
    this.students = students;
} 

我想创建一个新方法作为参数传递对象&#34; e&#34;。 我想返回e.getNome();

0 个答案:

没有答案