Java End-of-file

  • + 1 comment

    initialize x outside while loop man.

    int x=1; while (sc.hasNextLine()) { System.out.println(x++ + " " +sc.nextLine()); }