Jessy Jessy - 1 year ago 67
Java Question

Reading and displaying data from a .txt file

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

Answer Source
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)