Jessy Jessy - 2 months ago 11
Java Question

Reading and displaying data from a .txt file

How do you read and display data from .txt files?

BufferedReader in = new BufferedReader(new FileReader("<Filename>"));

Then, you can use in.readLine(); to read a single line at a time. To read until the end, write a while loop as such:

String line;
while((line = in.readLine()) != null)