Serialization is the process using which you can save the state of the object do some other medium (secondary storage/over a network, etc). The precondition before an object state is saved is that is should implement the Serializable interface.
If we want to control the way in which the object is written , we will use Externalizable interface.
Now having this little knowledge about serialization let us look what all are the differences between Serializable and Externalizable Interface.
If we want to control the way in which the object is written , we will use Externalizable interface.
Now having this little knowledge about serialization let us look what all are the differences between Serializable and Externalizable Interface.
- Serializable is a marker interface and Externalizable interface has methods which your implementation classes should provide.
- Serializable is the parent for Externalizable that is Externalizable extends Serializable interface.
- Externalizable interface provides complete control over how the object should be written out , while serializable interface uses the default implementation to write the object.
- Externalizable interface provides more control over the read/write process by implementing the readExternal and writeExternal methods which are part of Externalizable interface while Serializable does not have any method.
Posted in: