Following to some forums answers I’m using this:
while (fileReader.nextLine() != null) { String line = fileReader.nextLine(); System.out.println(line); }
… but it throws exception at the end anyway (Exception in thread “main” java.util.NoSuchElementException: No line found)
Advertisement
Answer
you should use while (fileReader.hasNextLine())