I\'ve been having trouble using java\'s Scanner class. I can get it to read my input just fine, but the problem is when I want to output something. Given multiple lines of i
You need to tell the program that there is going to be no more input. This is done by appending an EOF character. This can be done manually on Linux by pressing Ctrl-D in the console. I think on Windows you can press Ctrl-Z. The stream will be automatically closed if you are piping input from one program to another.
eg.
cat filename | java MyJavaProgram