What is the difference between Serializable and Externalizable in Java?

后端 未结 11 1121
轻奢々
轻奢々 2020-11-22 12:31

What is the difference between Serializable and Externalizable in Java?

11条回答
  •  Happy的楠姐
    2020-11-22 13:29

    Basically, Serializable is a marker interface that implies that a class is safe for serialization and the JVM determines how it is serialized. Externalizable contains 2 methods, readExternal and writeExternal. Externalizable allows the implementer to decide how an object is serialized, where as Serializable serializes objects the default way.

提交回复
热议问题