private static int[] loadMarks(String fileName) throws IOException {
int[] marks = new int[94];
/* complete */
Scanner input = new Scanner(fileName);
for(int i=0;i<94;i++) {
marks[i]=input.nextInt();
}
return marks;
}
Asked
Active
Viewed 22 times
-1

Patrick
- 5,526
- 14
- 64
- 101

Siyanda Mbatha
- 3
- 2
-
is the input supplied a string or an int? Does it work if scanner is initialized within the loop? – jidexl21 Sep 05 '17 at 13:06
-
i'm scanning the file that contains numbers only – Siyanda Mbatha Sep 05 '17 at 13:17
1 Answers
0
Scanner input = new Scanner(new File(fileName));
Try this, if your goal is to parse the contents of the file and not the actual string fileName

Tyler
- 955
- 9
- 20