Question
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()))
{
System.out.print((char)i);
}
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
a.
abc
b.
abcd
c.
abcde
d.
None of the mentioned
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. Which of the following is not a segment of memory in java?
View solution
Q. Does code Segment loads the java code?
View solution
Q. What is JVM?
View solution
Q. Which one of the following is a class loader?
View solution
Q. Which class loader loads jar files from JDK directory?
View solution
Q. Which of the following is not a memory classification in java?
View solution
Q. What is the Java 8 update of PermGen?
View solution
Q. Classes and Methods are stored in which space?
View solution
Q. Where is String Pool stored?
View solution
Q. The same import package/class be called twice in java?
View solution
Q. Which of these exceptions handles the situations when an illegal argument is used to invoke a method?
View solution
Q. Which of these exceptions will be thrown if we declare an array with negative size?
View solution
Q. Which of these packages contain all the Java’s built in exceptions?
View solution
Q. Which of these exceptions will be thrown if we use null reference for an arithmetic operation?
View solution
Q. Which of these class is used to create user defined exception?
View solution
Q. Which of these class provides various types of rounding functions?
View solution
Q. Which of these methods return a smallest whole number greater than or equal to variable X?
View solution
Q. Which of these method returns a largest whole number less than or equal to variable X?
View solution
Q. Which of function return absolute value of a variable?
View solution
Q. Which of these methods of Byte wrapper can be used to obtain Byte object from a string?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!