I need to read a text file line by line using Java. I use available() method of FileInputStream to check and loop over the file. But while reading,
available()
FileInputStream
user scanner it should work
Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { System.out.println(scanner.nextLine()); } scanner.close();