So my question is, why serializable interface does not contain methods or fields?
When we can use Serializable interface?
What happen during deserialization?
So my question is, why serializable interface does not contain methods or fields?
When we can use Serializable interface?
What happen during deserialization?
Serializable interface is a "Marker"or "Tagging" interface. Whenever a class implements the serializable interface, that class is "marked" as serializable and the objects of the class are given that property.
Serializable
interface is termed as 'Marker' interface. This interface has been created to let JVM
know that these Object
types are allowed to be serialized and deserialized. You would have directly read the documentation instead of posting this question on SO.
1) Java serialization does not need any methods.
2) You can use Serializable when you create a new class and you want it to be serializable
3) During serialization object class descriptors and then object fields are sent to a stream.
Details are here http://docs.oracle.com/javase/7/docs/technotes/guides/serialization/index.html