*
The moose likes I/O and Streams and the fly likes serialization for class Object references Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "serialization for class Object references" Watch "serialization for class Object references" New topic
Author

serialization for class Object references

kumarth ravi
Ranch Hand

Joined: Jun 01, 2007
Posts: 48
The classes which are declared in serialized class must be serialized?

Ex:



A class can be serialized with out giving error?

with regards
ravi
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Why not try it and see?


[Jess in Action][AskingGoodQuestions]
kumarth ravi
Ranch Hand

Joined: Jun 01, 2007
Posts: 48
I have written a simple program,but it has thrown exception.





error
-----
Exception in thread "main" java.io.NotSerializableException: B
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at SerialTest.main(SerialTest.java:27)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: serialization for class Object references
 
Similar Threads
serialization question
How many objects are serialized ?
How does marker interfaces work?
About Serialization and DeSerialization process
Can Serializable object contain non-serializable member variables that get serialized