Given the following program:.
import java.io.EOFException; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { try {//from w ww .j a va 2s . c om FileInputStream fis = new FileInputStream("seq.txt"); InputStreamReader isr = new InputStreamReader(fis); int i = isr.read(); while (i != -1) { System.out.print((char)i + "|"); i = isr.read(); } } catch (FileNotFoundException fnf) { System.out.println("File not found"); } catch (EOFException eofe) { System.out.println("End of stream"); } catch (IOException ioe) { System.out.println("Input error"); } } }
Assume that the file "seq.txt" exists in the current directory, has the required access permissions, and contains the string "Hello".
Which statement about the program is true?.
Select the one correct answer.
(d)
The read()
method of an InputStreamReader returns -1 when the end of the stream is reached.