1.

What will be printed to the output and written to the file, in the below program? import java.io.FileOutputStream; public class FileOutputStreamExample { public static void main(String args[]) { try { FileOutputStream fout=new FileOutputStream("D: mcqsmentor.txt"); String s="Welcome to Compscibits"; byte b[]=s.getBytes();//converting string into byte array fout.write(b); fout.close(); System.out.println("Success"); } catch(Exception e){System.out.println(e);} } }

A. Success to the output and Welcome to Compscibits to the file
B. only Welcome to Compscibits to the file
C. Compile time error
D. No Output
Answer» B. only Welcome to Compscibits to the file


Discussion

No Comment Found