What will be the output of the following Java program? (Note: inputoutput.java is stored in the disk.) [code] import java.io.*;

What will be the output of the following Java program? (Note: inputoutput.java is stored in the disk.)
Code:
    import java.io.*;
    class filesinputoutput 
    {
        public static void main(String args[]) 
        {
            InputStream obj = new FileInputStream("inputoutput.java");
            System.out.print(obj.available());
        }
    }
A. true
B. false
C. prints number of bytes in file
D. prints number of characters in the file
 
Answer: c
Explanation: obj.available() returns the number of bytes.
Output:
Code:
$ javac filesinputoutput.java
$ java filesinputoutput
1422
(Output will be different in your case)
 

Tìm kiếm

Back
Top