+1 vote
in JAVA by
What is the difference between Serializable and Externalizable interface?

1 Answer

0 votes
by

Below is the difference between serializable and externalizable

Serializable :

1) The Serializable interface does not have any method, i.e., it is a marker interface.

2) It is used to "mark" Java classes so that objects of these classes may get the certain capability.

3) It is easy to implement but has the higher performance cost.

4) No class constructor is called in serialization.

Externalizable :

1) The Externalizable interface contains is not a marker interface, It contains two methods, i.e., writeExternal() and readExternal().

2) The Externalizable interface provides control of the serialization logic to the programmer.

3) It is used to perform the serialization and often result in better performance.

4) We must call a public default constructor while using this interface.

.

Related questions

+3 votes
asked May 13, 2021 in JAVA by rajeshsharma
+1 vote
asked May 5, 2021 in JAVA by SakshiSharma
...