Skip to content

The difference between Serializable and Externalizable in Java?

Posted in Education, Uncategorized, and WhoCodeFirst

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.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version