在Java中,我们使用序列化的writeObject(Object obj)方法.ObjectOutputStreamObject
writeObject(Object obj)
ObjectOutputStream
Object
但是因为该方法只接受实现java.io.Serializable接口的对象(或者它会抛出NotSerializableException),为什么它仍然使用Object参数而不是Serializable像writeObject(Serializable o)?
java.io.Serializable
NotSerializableException
Serializable
writeObject(Serializable o)
有任何设计考虑因素吗?
java serialization objectoutputstream marker-interfaces
java ×1
marker-interfaces ×1
objectoutputstream ×1
serialization ×1