What is the serializable interface?
an interface that serializes an object. A class can be serialized only if it implements the serializable interface.
What is serialization?
The process of transforming the state information of an object into a form that can be stored or transmitted .
During serialization, an object writes its current state to a temporary store or a persistent store, and can then recreate the object by reading or deserializing state information from the store.
What situations require serialization?
When we need to transfer the state information of the object over the network, or persist the state information of the object , we need to serialize the object for future use.
serializable is primarily used to support two main features :
1,Java RMI (remote method invocation), RMI allows the operation of objects on the remote machine as on the local computer, when sending a message to a remote object, it is necessary to use the serialization mechanism to send parameters and accept the return value.
2,java javabean, the state information of the bean is usually configured at design time, the state information of the bean must be saved so that when the program is running, the state information can be restored, which also requires the order serializable mechanism.
Reproduced
Why Java classes implement serializable interfaces