File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 19670
    
  18

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: 19670
    
  18

You're welcome
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Inheritance and Serialization