About this question
I am trying to read lines from a text file in Java, but there is a lot going on. Is this the best way to do this? I am especially concerned with resource leaks.
import java.io.*;
public class Filing {
public static void main(String[] args) throws FileNotFoundException, IOException {
FileReader fr = new FileReader("/Users/thomaspovinelli/Desktop/apps.txt");
BufferedReader br = new BufferedReader(fr);
String buffer;
String fulltext="";
while ((buffer = br.readLine()) != null) {
System.out.println(buffer);
fulltext += buffer;
}
br.close();
fr.close();
}
}