I heard something like this
java myMainClass < myInputFile.txt
will provide a file as input to my Java program.
But how do I access that input?
That command is piping the file into STDIN, which in Java you can access as System.in
.
For example, if you want to use a Scanner:
Scanner input = new Scanner(System.in);