CuriousGuy CuriousGuy - 10 months ago 57
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.