How are the constructors called during serialization and deserialization
- When there is one class implementing serializable?
- When there is parent/child relationship and only child implements serializable?
- When there is parent/child relationship and both parent and child implements serializable?
Example:
Output:
So if you deserialized your object, its constructors doesn’t called, but default constructor of its parent will be called.
And don’t forget: all your serializable object should have a standard constructor without parameters.