This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The only problem there would be the changed data types. I don't think serialization can handle that, but you would have to try first to make sure. Maybe it will work if primitive types are widened, or if reference types are assignable, but I doubt it to be honest.
Rob Prime wrote:I wouldn't know right away how to solve this.
Do you think it is possible to solve this at all? If you change a String to an int in a class, you have to all intents and purposes created a different class. It is hardly going to serialise and deserialise at all.
Instead of Serializable, use Eternalizable. Then write and read a version number. In the readExternal() method, check the version number and then read only those fields that are applicable to that version. Note that the serialVersionUID needs to be hard coded so that changes in the class do not cause the UID value to change.
When I was your age I was toggling in the bootstrap code on the front panel