DEV Community

k@k
k@k

Posted on

Difference between Serializable and Externalizable in Java

This is one of the frequently asked questions from Java Serialization. The interviewer has been asking this question since the day Serialization was introduced in Java, but yet only a few good candidates can answer this question with some confidence and practical knowledge.

Serializable interface is used to make Java classes serializable so that they can be transferred over the network or their state can be saved on disk, but it leverages default serialization built-in JVM, which is expensive, fragile and not secure.

Externalizable allows you to fully control the Serialization process, specify a custom binary format and add more security measures.

Top comments (0)