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(Character.toUpperCase((char)q));
    }
    }
    }
    }
    }
    1. interview mania
    2. MANIA
    3. INTERVIEW
    4. INTERVIEW MANIA
    5. None of these
Correct Option: D

INTERVIEW MANIA



Your comments will be displayed only after manual approval.