I know what is serialization and why it is used, but my question:
- Why is serialization a marker interface?
- What is the potential benefit of not having
writeObject
,readObject
in Serializable interface because when we do serialization we finally override these 2 methods? How does
readResolve
ensure that the object created during deserialization is not the new object. I know the below and it is returning the same object during deserialization but who will call thisreadResolve
method internally?private Object readResolve() throws java.io.ObjectStreamException { return INSTANCE; }