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 = "InterviewMania";
    int len = object.length();
    char ch[] = new char[len];
    object.getChars(0, len, ch, 0);
    CharArrayReader chararray = new CharArrayReader(ch);
    CharArrayReader chararray0 = new CharArrayReader(ch, 0, 9);
    int i;
    try
    {
    while((i = chararray0.read()) != -1)
    {
    System.out.print((char)i);
    }
    }
    catch (IOException e)
    {
    e.printStackTrace();
    }
    }
    }
    1. Interview
    2. Mania
    3. InterviwMania
    4. Runtime Error
    5. Compilation Error
Correct Option: A

Interview



Your comments will be displayed only after manual approval.