What is the difference between Serializable and Externalizable interface?


No. Serializable Externalizable
1) The Serializable interface does not have any method, i.e., it is a marker interface. The Externalizable interface contains is not a marker interface, It contains two methods, i.e., writeExternal() and readExternal().
2) It is used to "mark" Java classes so that objects of these classes may get the certain capability. The Externalizable interface provides control of the serialization logic to the programmer.
3) It is easy to implement but has the higher performance cost. It is used to perform the serialization and often result in better performance.
4) No class constructor is called in serialization. We must call a public default constructor while using this interface.
0 answers