I have a text file in the following format:
Student1 Marks
Student2 Marks
The first column is the key.
This is what I have tried so far
Scanner scanner = new Scanner(new FileReader("marks.txt"));
HashMap<String,Integer> map = new HashMap<String,Integer>();
while (scanner.hasNextLine()) {
String[] columns = scanner.nextLine().split("\t");
map.put(columns[0],columns[1]);
}
System.out.println(map);
}