Question ID :953742349090
Q) Which of these can act as a source for an input stream as well as a destination for an output stream?
Correct Answers:
A network connection
A file
A pipe
Wrong Answer: An array of chars - Option comment "You can create a CharArrayReader and CharArrayWriter but there is nothing like CharArrayInputStream and CharArrayOutputStream"
As explained by JQ+ tech support, "Array of chars is not a correct choice as you cannot create any "stream" out of it. You can only create "Reader" and "Writer" out of it."
Sec. 18.1, p549 Programmer's Guide to
Java Certification 2, Rev1 by Khalid Mugal and Rolf Rasmussen says,
"There are two kinds of streams
byte streams and
character streams. An
input stream acts as a source of data. An
output stream acts as a destination of data. The following entities can act as both input and output stream:
- an array of bytes or characters
- a file
- a pipe
- a network connection
"
Also, Jane Griscti's notes on I/O seems to agree with Mughal and Rasmussen's assertions.
My thought is that the correct answers given above are specific to InputStream and OutputStream classes (byte-oriented) as opposed to input and output streams (byte and character-oriented) in general.
Im confused , I'd appreciate it if anyone clarify if array of chars/bytes is a legitimate answer to the JQ+ question above and if not, how does it differ in Khalid and Jane's assertions?
------------------
~James Baud
He who asks, is a fool for five minutes;
but, he who does not ask, remains a fool forever. (Chinese proverb)
<B>~James Baud</B><P>He who asks, is a fool for five minutes;<BR>but, he who does not ask, remains a fool forever. (Chinese proverb)