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)
    {
    String object = "interview Mania";
    byte p[] = object.getBytes();
    ByteArrayInputStream object1 = new ByteArrayInputStream(p);
    for (int K = 0; K < 2; ++K)
    {
    int q;
    while ((q = object1.read()) != -1)
    {
    if(K == 0)
    {
    System.out.print((char)q);
    }
    }
    }
    }
    }
    1. interview
    2. interview Mania
    3. Maniainterview
    4. interview Mania
    5. None of these
Correct Option: D

interview Mania



Your comments will be displayed only after manual approval.