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
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.
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();
}
}