【发布时间】:2011-08-01 19:22:40
【问题描述】:
这就是我目前所拥有的:
public String[] findStudentInfo(String studentNumber) {
Student student = new Student();
Scanner scanner = new Scanner("Student.txt");
// Find the line that contains student Id
// If not found keep on going through the file
// If it finds it stop
// Call parseStudentInfoFromLine get the number of courses
// Create an array (lines) of size of the number of courses plus one
// assign the line that the student Id was found to the first index value of the array
//assign each next line to the following index of the array up to the amount of classes - 1
// return string array
}
我知道如何查找文件是否包含我要查找的字符串,但我不知道如何检索它所在的整行。
这是我第一次发帖,如果我做错了什么,请告诉我。
【问题讨论】:
-
如果这是家庭作业,应该这样标记。
-
您可以添加输入文件的示例吗?