1.

import java.io.*;
public class MyProgram { public static void main(String args[]) { FileOutputStream out = null; try { out = new FileOutputStream("test.txt"); out.write(122); } catch(IOException io) { System.out.println("IO Error."); } finally { out.close(); } }
}
and given that all methods of class FileOutputStream, including close(), throw an IOException, which of these is true?

A. This program will compile successfully.
B. This program fails to compile due to an error at line 4.
C. This program fails to compile due to an error at line 6.
D. This program fails to compile due to an error at line 18.
Answer» E.


Discussion

No Comment Found

Related MCQs