You are viewing a single comment's thread. Return to all comments →
In fact, you can shorten it even further (at a potential loss of readability) by including the print statement within the for loop:
for(int i = 1; scan.hasNext(); System.out.println(i + " " + scan.nextLine()), i++);
Seems like cookies are disabled on this browser, please enable them to open this website
Java End-of-file
You are viewing a single comment's thread. Return to all comments →
In fact, you can shorten it even further (at a potential loss of readability) by including the print statement within the for loop: