File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Check out this I/O Ques

 
josephine chen
Ranch Hand
Posts: 216
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For all certification aspirants ......

Which of the following can be used to
create a related PipedInputStream/PipedOutputStream
pair?
a. PipedInputStream pis = new PipedInputStream();
PipedOutputStream pos = new PipedOutputStream(pis);--true
b. PipedInputStream pis = new PipedInputStream();
PipedOutputStream pos = new PipedOutputStream();
pis.read(pos); -arguments are wrong
pos.write(pis);
c. PipedInputStream pis = new PipedInputStream(pos);
PipedOutputStream pos = new PipedOutputStream(pis);--correct
d. PipedInputStream pis = new PipedInputStream();
PipedOutputStream pos = new PipedOutputStream();
pis.connect(pos);
pos.connect(pis);
correct becoz connect of PipedOutputStream takes PipedInputStream as arg


 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following can be used to create a related PipedInputStream/PipedOutputStream pair?
a. PipedInputStream pis = new PipedInputStream();
PipedOutputStream pos = new PipedOutputStream(pis);--true
b. PipedInputStream pis = new PipedInputStream();
PipedOutputStream pos = new PipedOutputStream();
pis.read(pos); -arguments are wrong
pos.write(pis);

c. PipedInputStream pis = new PipedInputStream(pos); // < -- pos is not defined
PipedOutputStream pos = new PipedOutputStream(pis);--correct

d. PipedInputStream pis = new PipedInputStream();
PipedOutputStream pos = new PipedOutputStream();
pis.connect(pos); // < --- THIS WILL CONNECT THE STREAMS
pos.connect(pis); // < --- WILL THROW IOException. Aready connected

So (a) Only.


[This message has been edited by Tony Alicea (edited February 10, 2000).]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic