Possible Duplicate:
Why Java needs Serializable interface?
According to Serializability in Java docs :
Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized. All subtypes of a serializable class are themselves serializable. The serialization interface has no methods or fields and serves only to identify the semantics of being serializable
Why doesn't the Object already implement Serializable
? Members that we wouldn't want to be serializable may be made as transient
. Why prevent the default Serializability?