CuriousGuy CuriousGuy - 1 year ago 77
Java Question

Serialization not implemented?

What I understand is that I can implement

interface to make my object seriazable.

But I don't get where is
implemented when
is an interface, so it doesn't contain implementation of methods, just a definition?

Answer Source

As you already noticed, the Serializable is a Marker Interface and does not have any methods to implement. Implementing Serializable is just a note that this one is eligible for serialization which is handled using ObjectOutputStream.

Methods you mentioned need to be implemented in a class implementing the Serializable interface and will be picked up automatically. Since there is no obligation for implementing them, they are not included in the interface.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download