When to Serializable & Externalizable

Can anybody clear me.  When to implement Serializable and when to implement Externalizable?
And how they work serializing a object.

Umapada Manna

Basically SERIALIZABLE uses default implementation for reading and writing the object you want to persist.
You just have to implement SERIALIZABLE interface for your class and rest will be taken care.

For EXTERNALIZABLE you will have to implement the readExternal() and writeExternal() methods.
As in you can specify your own way of storing the information and retrieving the information of the object.

Unless you have very specific requirements one wouldn't use EXTERNALIZABLE.

SERIALIZABLE is the most common form of using.

All you would specify is to implement the SERIALIZABLE interface in the class declaration and nothing more.

Pallav

Do you have a Java Problem?
Ask It in The Java Forum

Java Books
Java Certification, Programming, JavaBean and Object Oriented Reference Books

Return to : Java Programming Hints and Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.