I want to read in data from a text file which is full of integers and have the program print those integers out to the screen while summing them. This shouldn\'t be hard, b
You are getting the error (exception) because your file has very big numbers that do not fit on Integer types. You should use Long.
So, use: aScanner.nextLong() instead of aScanner.nextInt().
aScanner.nextLong()
aScanner.nextInt()
EDIT: You should also change the type of the sum variable from int to long.
sum
int
long
Your code will work fine.