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;
System.out.println(lineNum + " " + scan.nextLine());
This was my code that I used, and it works flawlessly.