Serialization 5 Min Drill
- Class must implement Serializable before its objects can be
- Transient variable will not be serialized
- Static class members will also be ignored during the
serialization and deserialization process.
- Default serialized form of an inner class is ill-defined.
- If a superclass implements Serializable, then its subclasses do
- If a superclass doesn't implement Serializable, then when a
subclass object is deserialized, the superclass constructor will be
invoked, along with its superconstructor(s).
- If the class or one of its contained classes does not properly
implement the Serializable interface then will throw a
- When you deserialize an object, the constructor of the serialized
class is not called.
- Inner classes should not implement Serializable.
- You can supplement a class's automatic serialization process by
implementing the writeObject() and readObject() methods.
- ObjectOutputStream.writeObject() method serializes objects, &
ObjectInputStream.readObject() method deserializes objects.