Place the fragments into the program, so that the program will get lines from the text file, display them, and then close all the resources.

DRAG DROP
Place the fragments into the program, so that the program will get lines from the text file, display them, and then close all the resources.

DRAG DROP
Place the fragments into the program, so that the program will get lines from the text file, display them, and then close all the resources.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


fjbo221

fjbo221

public static void main(String args[]) {
try {
File x1 = new File(“MyFile.txt”);
FileReader x2 = new FileReader(x1);
BufferedReader x4 = new BufferedReader(x2);
String x3 = null;
while ((x3 = x4.readLine()) != null) {
System.out.println(x3);
} x4.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}