BufferedReaderbr=newBufferedReader(newFileReader("D:\student.txt"));
StringtmpStr=br.readLine();
while(tmpStr!=null){
intfirstIndex=tmpStr.indexOf("");
intsecondIndex=tmpStr.indexOf("",firstIndex+1);
intthirdIndex=tmpStr.indexOf("",secondIndex+1);
intforthIndex=tmpStr.indexOf("",thirdIndex+1);
IntegerstuId=Integer.parseInt(tmpStr.substring(0,firstIndex));
StringstuName=tmpStr.substring(firstIndex+1,secondIndex);
IntegerstuYW=Integer.parseInt(tmpStr.substring(secondIndex+1,thirdIndex));
IntegerstuSX=Integer.parseInt(tmpStr.substring(thirdIndex+1,forthIndex));
IntegerstuYY=Integer.parseInt(tmpStr.substring(forthIndex+1));
Studentstudent=newStudent();
student.setStuId(stuId);
student.setStuName(stuName);
student.setStuYW(stuYW);
student.setStuSX(stuSX);
student.setStuYY(stuYY);
students.add(student);
tmpStr.readLine();
}
//创建一个学生实体类封装stuIdstuNamestuYWstuSxstuYY这5个属性。。。
//已经帮你把数据拆分出来并以Student对象的形式放入集合中了接下来给分吧哇咔咔