5 years ago in Java File Input Output

What is the output of this program?

import java.io.*;
class Chararrayinput {
public static void main(String[] args) {
String obj = "abcdef";
int length = obj.length();
char c[] = new char[length];
CharArrayReader input1 = new CharArrayReader(c);
CharArrayReader input2 = new CharArrayReader(c, 0, 3);
int i;
try {
while ((i = input1.read()) != -1) {
catch (IOException e) {
// TODO Auto-generated catch block

[A] abc
[B] abcd
[C] abcde
[D] abcdef
Next Question

Overall Stats

Attempted 286
Correct 52
Incorrect 79
Viewed 155


Bindushree Bn - 2 years ago

Post answer with explation

Nevena Miuchin
Nevena Miuchin - 1 week ago

Nevena Miuchin from Ottawa, Canada is saying abcdef is correct answer

akshay kharat
akshay kharat - 1 week ago

akshay kharat from Pune, India is saying abcd is correct answer

Zo Go
Zo Go - 1 month ago

Zo Go from Casablanca, Morocco is saying abcd is correct answer

ROSHINI G - 3 months ago

ROSHINI G is saying abcd is correct answer

Related Questions

Which of these stream contains the classes which can work on character stream?

  • [A] InputStream
  • [B] OutputStream
  • [C] Character Stream
  • [D] All of the mentioned

Which of these class is not a member class of java.io package?

  • [A] String
  • [B] StringReader
  • [C] Writer
  • [D] File

Which of these classes can return more than one character to be returned to input stream?

  • [A] BufferedReader
  • [B] Bufferedwriter
  • [C] PushbachReader
  • [D] CharArrayReader