You are viewing a single comment's thread. Return to all comments →
while(scan.hasNext()) should be the line you use. Also, don't use the strings. The only time String should be in the code is the very beginning.
Scanner scan = new Scanner(System.in);
int lineNum = 1; while(scan.hasNext()) { System.out.println(lineNum + " " + scan.nextLine()); lineNum++;
This was my code that I used, and it works flawlessly.
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 →
while(scan.hasNext()) should be the line you use. Also, don't use the strings. The only time String should be in the code is the very beginning.
Scanner scan = new Scanner(System.in);
This was my code that I used, and it works flawlessly.