MCQOPTIONS
Saved Bookmarks
| 1. |
What will be printed to the output and written to the file, in the below program?import java.io.*; public class FileOutputStreamExample{ public static void main(String args[]) { try { FileOutputStream FOS = new FileOutputStream("D: InterviewMania.txt"); String str="Welcome to the Interview Mania."; byte q[]=str.getBytes();//converting string into byte array FOS.write(q); FOS.close(); System.out.println("Success"); } catch(Exception e){System.out.println(e);} } } |
| A. | Only "Welcome to the Interview Mania" |
| B. | Compile time error |
| C. | "Success" to the output and "Welcome to the xInterview Mania" |
| D. | Runtime error |
| E. | None of these |
| Answer» D. Runtime error | |