【发布时间】:2018-06-08 13:33:26
【问题描述】:
以下是我的 Student 对象的构造函数。我将使用学生名单。我需要存储列表,因此即使程序关闭,我仍然可以访问所有内容。我能想到的唯一方法是使用读取器/写入器和文本文件。
1) 有没有更有效的方法来存储这些信息?
2)如果没有,我如何使用读取器/写入器来存储每个字段?
public Student(String firstName, String lastName, String gender, String
state, String school, String lit, String wakeUp, String sleep, String
social,String contactInfo, String country, String major) {
this.firstName = firstName;
this.lastName = lastName;
this.gender = gender;
this.state = state;
this.school = school;
this.lit = lit;
this.wakeUp = wakeUp;
this.sleep = sleep;
this.social = social;
this.contactInfo = contactInfo;
this.country = country;
this.major = major;
}
【问题讨论】:
标签: list text-files writer reader