Hi, newbie here. First post, learning
Java, etc. I've made it through most of the Head First book and also a professor-authored book for the class I'm taking. I'm trying to accomplish something for an assignment which requires getting command line args from a text file, which I can do, but I'm finding that later references in my main method to system input seem to be getting processed before I think they should. In short, things are happening in a confusing order. I've simplified what I'm working on into a
test code to isolate the issue. Please see the files below. I am executing:
java argstest.java<args.txt
I would expect the output to be 1 1 1 10 10 10. But that actual output is 1 1 1 10. I would expect the for loop to go through all iterations of arg BEFORE the do/while loop beings executing, but this doesn't seem to be the case. Is there an explanation for this, and is there a way I can change this behavior?
File argstest.java:
File args.txt: