Java IO Serialization
© examsiri.com
Question : 12 of 17
Marks:
+1,
-0
place the fragments into the program, so that the program will get lines from a text file, display them, and then close all the resources.
Code Fragments:
import java.io.*
public class ReadFile {
  public static void main (String [] args) {
   try {
    File (1)___ = new File ("MyText . txt");
    (2)___ (3)____ = new (4)____ (x1);
    (5)____ x4 = new (6)____ (x2);
    String x3 = null;
    while (( x3 = (7)___. (8)___ ()) ! = null ) {
     System.out.println(x3);
    } (9)___. (10)___();
   } catch (Exception ex) {
    ex.printStackTrace();
   }
  }
}
Code Fragments:
BufferedReader
StreamReader
FileReader
readLine
readIn
read
closeFile
close
x1
x2
x3
x4
Go to Question: