Serialization, Evolution, and the Addition of a New SuperClass

Running the Example

Complete the following procedure to compile and run this example:

  1. From yourbasedir/objectserializationexamples/AddingNewSuperClassAndEvolution, compile the Original Class using JDK™ 1.2 or higher:
      javac OriginalClass.java
    
  2. Run the Original Class with the serialization flag:
      java OriginalClass -s
    
  3. Compile the Evolved Class:
      javac EvolvedClass.java
    
  4. Run the Evolved Class with the deserialization flag:
      java EvolvedClass -d
    

This procedure tests compatibility in one direction only. To test bidirectional compatibility, perform the same procedure in the other direction (in steps 1-4, replace the original class name with the evolved class name, and vice versa).

blue bar

For more information:

Abstract
Sources
List of Examples

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

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部