• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Check out this I/O Ques

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Whatever. Here's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic