Using Serialization with Evolution

Abstract

Under certain circumstances, when Java objects use serialization to store objects, the version of the class reading the data could be different from the version of class that wrote that data.

This example demonstrates some of the compatible changes that Serialization handles without using class-specific methods.

As with all examples that deal with evolution, the evolved class (AClass) must define a serialVersionUID field that is obtained using the command serialver on the original class (AClass).

Additional Information

Source Files
Running the Example
List of Examples

Oracle and/or its affiliates
Java Technology

Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.

Contact Us