In Java, we use the writeObject(Object obj)
method of ObjectOutputStream
to serialize an Object
.
But since the method only takes object that implements the java.io.Serializable
interface (or it will throw NotSerializableException
), why does it still use the Object
parameter rather than Serializable
, like writeObject(Serializable o)
?
Is there any designing consideration?