Home » JAVA Programming » Files and I/O » Question
  1. What is the output of this program?
    import java.io.*;
    public class filesinputoutput_Example
    {
    public static void main(String args[])
    {
    InputStream obj = new FileInputStream("inputoutput.java");
    System.out.print(obj.available());
    }
    }
    1. Compilation error
    2. Runtime error
    3. true
    4. false
    5. None of these
Correct Option: A

filesinputoutput.java:6: error: unreported exception FileNotFoundException; must be caught or declared to be thrown
InputStream obj = new FileInputStream("inputoutput.java");
^
filesinputoutput.java:7: error: unreported exception IOException; must be caught or declared to be thrown
System.out.print(obj.available());
^
2 errors



Your comments will be displayed only after manual approval.