wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes Inheritance and Serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Inheritance and Serialization" Watch "Inheritance and Serialization" New topic
Author

Inheritance and Serialization

harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
If super-class is not serializable but subclass is serializable
1. The super class must have no argument constructor accessible to subclass.
2. This constructor will be used to initialize subclass' sub-object.


please explain above statement.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Try this code. After that remove the first constructor of SuperClass and try again.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
harshada patil
Ranch Hand

Joined: Mar 12, 2011
Posts: 96
hey thanks rob for your solution... Now i got the point....
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inheritance and Serialization
 
Similar Threads
Serialization via Inheritance
Deserialization
How Inheritance Affects Serialization
Default constructor
Serialization doubt