File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes ObjectInput & ObjectOutput Streams 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 "ObjectInput & ObjectOutput Streams" Watch "ObjectInput & ObjectOutput Streams" New topic

ObjectInput & ObjectOutput Streams

Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
In Asim Khan's note it is written that,

ObjectInptStream & ObjectOutputStream are processing streams, so it mutst be constructed on another stream(a data sink stream rather,like FileOutputStream)
My question is that both ObjectInput & ObjectOutput Streams have two constructor one of which does not take any arguments, i.e default constructor.So how we will construct ObjectInput & ObjectOutput Streams using this constructor.
Count the flowers of ur garden,NOT the leafs which falls away!

Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Vikrama,
The only way you can use the protected constructor which accepts no parameters is to sublcass the ObjectInputStream or ObjectOutputStream. The no arg constructor is needed so that subclasses don't need to create any extra data just to get the functionality correct.
Just using the I/O methods in any java program will not allow you to call the no argument constructor.
I agree. Here's the link:
subject: ObjectInput & ObjectOutput Streams
It's not a secret anymore!