Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Check out this I/O Ques Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Check out this I/O Ques " Watch "Check out this I/O Ques " New topic
Author

Check out this I/O Ques

josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
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

Joined: Jan 30, 2000
Posts: 3222
    
    5
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).]


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check out this I/O Ques