I am teaching myself
Java by working my way through a book. Part of the solution to one of its exercises is to fill an array from a text file. I was getting the above error so I wrote some
test code. Can someone explain to me what I am doing wrong.
The output:
$ java Exercise6_4 < scores.txt
Score = 25
Score = 35
Score = 43
Score = 17
Score = 8
Score = 13
Score = 45
Score = -1
Exception in
thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:838)
at java.util.Scanner.next(Scanner.java:1461)
at java.util.Scanner.nextInt(Scanner.java:2091)
at java.util.Scanner.nextInt(Scanner.java:2050)
at Exercise6_4.main(Exercise6_4.java:11)
Thanks, Jim