Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

What is the difference between Serializable and Externalizable interface?

Pragya Keshap answered on February 4, 2023 Popularity 2/10 Helpfulness 1/10

Contents


More Related Answers

  • import java.io.serializable
  • make Python class serializable
  • serializable java
  • What is Externalizable interface in Java?
  • serializable
  • What happens if your Serializable class contains a member which is not serializable? How do you fix it?

  • What is the difference between Serializable and Externalizable interface?

    0

    Serializable is a marker interface but Externalizable is not a marker

    interface.

    When we implement Serializable interface, the class is serialized

    automatically by default. We can override writeObject() and

    readObject()methods to control more complex object Serialization

    process.

    In case of Externalizable, we use readExternal() and

    writeExternal() methods to give control to class for class's

    serialization process.

    Serializable interface is based on recursive algorithm.

    Serializable gives you two options. One option is to provide custom

    way of serialization, the other default way. In Externalizable, you

    have to always implement readExternal() and writeExternal()

    methods.

    A public no-arg constructor is needed while using Externalizable

    interface.

    In Serialization, we need to define serialVersionUID. If it is not

    explicitly defined it will be generated automatically based on all the

    fields, methods of the class

    https://www.baeldung.com/java-externalizable#:~:text=Performance-,The%20java.,control%20over%20the%20serialization%20process.

    Popularity 2/10 Helpfulness 1/10 Language java
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Feb 04 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.