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 = "abcdefgh";
int length = obj.length();
char c[] = new char[length];
obj.getChars(0, length, c, 0);
CharArrayReader input1 = new CharArrayReader(c);
CharArrayReader input2 = new CharArrayReader(c, 1, 4);
int i;
int j;
try {
while ((i = input1.read()) == (j = input2.read())) {
catch (IOException e) {
// TODO Auto-generated catch block

[A] abc
[B] abcd
[C] abcde
[D] None of the mentioned
Next Question

Overall Stats

Attempted 215
Correct 51
Incorrect 57
Viewed 107


Nevena Miuchin
Nevena Miuchin - 4 days ago

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

akshay kharat
akshay kharat - 1 week ago

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

Vaibhav Bisht
Vaibhav Bisht - 1 month ago

Vaibhav Bisht from Dehradun, India is saying abcd is correct answer

Zo Go
Zo Go - 1 month ago

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

Charlton Olmos
Charlton Olmos - 3 months ago

Charlton Olmos from Lincoln, Canada is saying None of the mentioned is correct answer

Related Questions

Which of these class is used to read characters in a file?

  • [A] FileReader
  • [B] FileWriter
  • [C] FileInputStream
  • [D] InputStreamReader