What is the difference between Serializable and Externalizable in Java?
Key differences between Serializable
and Externalizable
Serializable
is marker interface without any methods. Externalizable
interface contains two methods: writeExternal()
and readExternal()
.Serializable
interface. Programmer defined Serialization process will be kicked-in for classes implementing Externalizable
interface.Externalizable
interface. You can support different versions of your object. If you implement Externalizable
, it's your responsibility to serialize super
classSerializable
uses reflection to construct object and does not require no arg constructor. But Externalizable
demands public no-arg constructor.Refer to blog by Hitesh Garg
for more details.