Home » JAVA Programming » Files and I/O » Question
  1. What is the output of this program?
    import java.io.*;
    public class Chararrayinput_Example
    {
    public static void main(String[] args)
    {
    String object = "Interview Mania";
    int length = object.length();
    char p[] = new char[length];
    object.getChars(0,length,p,0);
    CharArrayReader input1 = new CharArrayReader(p);
    CharArrayReader input2 = new CharArrayReader(p, 0, 3);
    int K;
    try
    {
    while ((K = input1.read()) != -1)
    {
    System.out.print((char)K);
    }
    }
    catch (IOException e)
    {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    }
    1. Interview
    2. Mania
    3. Interview Mania
    4. InterviewMania
    5. None of these
Correct Option: C

Interview Mania



Your comments will be displayed only after manual approval.