What is Externalizable in Java?



Externalization is used whenever we need to customize serialization mechanism. If a class implements an Externalizable interface then, object serialization will be done using writeExternal() method.

Whereas at receiver’s end when an Externalizable object is a reconstructed instance will be created using no argument constructor and then the readExternal() method is called.

If a class implements only Serializable interface object serialization will be done using ObjectoutputStream.

At the receiver’s end, the serializable object is reconstructed using ObjectInputStream.

Lakshmi Srinivas
Lakshmi Srinivas

Programmer / Analyst / Technician


Advertisements