I currently have an implementation of a program where I read in the input using the Scanner class. Integer by integer. I do this by piping the input file via the command line.
java program < input.txt
I need to avoid piping the input by using an argument on the command line to open the file in my program.
java program --file=input.txt
or something similar. I understand that I could parse the command line argument, extract the text "input.txt" and then use a class like "BufferedReader" or something similar to read the file.
I am just curious if there is away to use the input file (no piping) AND still use the Scanner class. Which means I wouldn't have to change over my nextInt() and other such calls.