This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Question in JQ+... Which of these can act as a source for an input stream as well as a destination for an output stream? Select all the 3 correct answers: A)A network Connection B)A file C)A pipe D)A string E)Array of chars Here there are 4 correct answers: ie. A)B)C)E)..But the question asks for 3 correct answers?/ If such case arises in the exam, then what are we supposed to do?. Sonir
Streams only work with single bytes. A java character is a 2 byte char type; thus, streams can't use arrays of characters as a source or destination. A Reader or Writer can work with characters, however. The correct answers for this question are A, B, and C. Rob
<a href="http://www.rajindery.com" target="_blank" rel="nofollow">Rajinder Yadav</a><p>Each problem that I solved became a rule which served afterwards to solve other problems. --Rene Descartes
Readers/Writers and In(Out)outStreams form two different branches of the i/o classes tree. All the "readers" (or writers) extend from java.io.Reader (or java.io.Writer), while all input "streams" (or output streams) extend from java.io.InputStream (or java.io.OutputStream). This question is asking about "streams" and so CharArrayReader, CharArrayWriter are not valid (because they are not streams but reader and writer). I do not remember the question id but I believe this explanation is given in the question. HTH, Paul.