I don't know why I keep getting an InputMismatchException :/ It highlights when I call the load() method.
Thanks
import java.util.*;
import java.io.*;
public class GradeManager {
private ArrayList <Student> StudentGrades;
public GradeManager(){
StudentGrades=new ArrayList<Student>();
load();
}
public void load(){
Scanner fileIn=null;
try{
fileIn=new Scanner(new File("grades.txt"));
}catch(FileNotFoundException e){
System.out.print("Cannot find file.");
System.exit(-1);
}
while(fileIn.hasNextLine()){
//fileIn.nextLine();
StudentGrades.add(new Student(fileIn.nextLine(), fileIn.nextInt()));
}
}
public static void main(String[] args){
GradeManager g=new GradeManager();
}
}
This is the format of the file:
Name
Grade(Integer)
...