We have a super class called "Vehicle", that implements the marker interface Serializable. Then we have a child class called "Car", that inherits "Vehicle", thus the child class "Car" also implements the Serializable marker interface, because of it's parent "Vehicle".
Now we can Serialize any instance of a Vehicle to a File, without any problems. But when we try to perform Deserialization of that File, to an Object of type "Car", then the program throws an Exception.
The way I solved this is by implementing the Serializable marker interface manually in the "Car" class.
Why is that the case? From all things I read on Serialization today, nobody seems to cover this issue.
The conclusion I came to is the following: When the "Car" class inherits the "Vehicle" class, it also inherits the interface implemented in "Vehicle", thus the "Car" object is serializable, but once we serialize an instance of the "Car" object to a File (for example: "car1.ser"), the "car1.ser" file has an object written to it, with all of it's modifiers, attributes, methods and etc. But somehow the object of type "Car", that is written to the "car1.ser" file, does not inherit the "Serializable" marker from it's parent. What is the reason for that, I am not really sure.