I thought so too. I tried to use the following modification but got the following from the compiler:
Java:28 unreported exception java.io.IOException; must be caught or declared to be thrown inputStream.close();
^
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
public class Ready {
FileReader inputFileReader = null;
BufferedReader inputStream = null;
//Define Constructor
Ready(){
try {
String inputFileName = "C:/Core/data.txt";
inputFileReader = new FileReader(inputFileName);
inputStream = new BufferedReader(inputFileReader);
String inLine = null;
while((inLine = inputStream.readLine()) != null){
System.out.println(inLine);
}
inputStream.close();
}catch(IOException e) {
System.out.println("Boo!");
e.printStackTrace();
}
}
public static void main(String[] args){
new Ready();
}
}