Using Scanner, am I able to redirect on the fly? I am familiar with redirection in C. Is redirection in Java similar? Do I have to redirect in the following manner:
java myprogram < mytestfile.txt
or can I redirect on the fly with Scanner?
Also, is end of file in Java the same as when I provide Scanner input and hit return?
What I desire to do is allow both console use and redirection. If the user prefers redirection, then my program will use Scanner and StringTokenizer to parse each line of the file, ignoring /n and sending a long concatenated string as input further along. If the user prefers console, then I have a method that will read a file and the program continues.
Edited by: 832844 on Feb 24, 2011 8:29 AM