Read lines of text from a file with the BufferedReader class



This example shows how to read the contents of a file line by line.
By using the BufferedReader class we can read line-by-line without having to worry about
linebreaks. We just call it’s readLine() method for as long as it doesn’t return null, which it does when it has reached the end of the file.
Don’t forget to call close() on the BufferedReader when done.







Search for more Java info on this site here:
Custom Search


Please type any questions here.