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

Exception in thread "main" java.io.FileNotFoundException: Interviewmania.com (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
at InputStream_Example.main(InputStream_Example.java:6)



Your comments will be displayed only after manual approval.