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
In addition to lockstock's answer, you might want to consider adding textfile.hasNext() OR textfile.hasNextInt() for your while loop.
static void filereader(Scanner textfile) {
int sum = 0;
while(textfile.hasNextInt()) {
int nextInt = textfile.nextInt();
System.out.println(nextInt);
sum += nextInt;
}
}