// Serializable subclass of nonserializable stateful class import java.io.*; public class Foo extends AbstractFoo implements Serializable { private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); // Manually deserialize and initialize superclass state int x = s.readInt(); int y = s.readInt(); initialize(x, y); } private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); // Manually serialize superclass state s.writeInt(getX()); s.writeInt(getY()); } // Constructor does not use any of the fancy mechanism public Foo(int x, int y) { super(x, y); } }


微信网友_7565568760549376
6月22日
暂无贡献等级
湮灭圣者 LV1
2024年1月20日
15575564465 LV1
2023年9月14日
朱俪的邮件及存储 LV8
2023年3月22日
绝对零度 LV4
2022年8月2日
你脚上银铃响了 LV1
2021年10月27日
大隐隐于市 LV2
2021年7月2日
916403064 LV2
2021年6月13日
smile soft
2021年4月28日
暂无贡献等级
有理想的中年人 LV1
2021年3月16日