I have in my code a hardcoded name for a text file I am reading.
String fileName = "test.txt";
However I now have to use a command argument like so:
text.java arg1 arg2 arg3 (can be any amount) < test.txt
Can anyone help me please?
I have it getting the arguments no problem just not sure on the file. Thank you
I have tried:
String x = null;
try {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
while( (x = f.readLine()) != null )
{
System.out.println(x);
}
}
catch (IOException e) {e.printStackTrace();}
System.out.println(x);
}
However my application now hangs on readLine, any ideas for me to try please?