我有一類事情:在這種Java情況下需要哪些序列化?
public abstract class Thing {
// prevent instantiation outside package. Indeed, no Things will
// ever actually have a runtime class of Thing
Thing(){};
public static Thing create() {
return new SpecialThing1();
}
public static Thing createSpecial() {
return new SpecialThing2();
}
}
final class SpecialThing1 extends Thing {/* etc etc */}
final class SpecialThing2 extends Thing {/* etc etc */}
基本上我想要的目標客戶最終使用是序列化,並在客戶端知道,他們將可序列化。那麼哪個類需要實現Serializable?哪些需要serialVersionUID?