BufferedReader br = new BufferedReader(new FileReader("day03\\一个人的秋季.txt"));
ArrayList<Student> array = new ArrayList<>();
String line;
while ((line = br.readLine()) != null) {
String[] str = line.split(",");
Student s = new Student();
s.setSid(Integer.parseInt(str[0]));
s.setName(str[1]);
s.setAge(Integer.parseInt(str[2]));
s.setAddress(str[3]);
array.add(s);
}
br.close(); |
|