My program is compiles but throws the following exception at runtime:- java.io.NotActiveException: not in call to writeObject at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:413) at Test.writeObject(Test.java:10) at Test.main(Test.java:23)
please explain me why it throws NotActiveException,I am confused....
[ August 10, 2008: Message edited by: Ashok Pradhan ]
[ August 10, 2008: Message edited by: Ashok Pradhan ] [ August 10, 2008: Message edited by: Ashok Pradhan ]
but how can I invoke the writeObject() it throws NotActiveException and what are the changes needed to fulfill my program's requirement.
Basically, you are *not* supposed to call the writeObject() method directly. It is a method used to support Serialization. See Ulf explanation on how to serialize an object. The serialization will indirectly call the writeObject() method.
Now I got it.invoking readObject(ObjectOutputStream os) directly is the wrong process and it is automatically called in the serialization process.am I correct !!!.and my program now compiles and run successfully..
Thanks Ulf Dittmer and Henry !!! [ August 10, 2008: Message edited by: Ashok Pradhan ]
expectation is the root of all heartache - shakespeare. tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss