writeObject(Object obj) 是否写入对象的整个 class?

Does writeObject(Object obj) write the whole class of the object?

关于 writeObject(Object obj) 来自 ObjectOutputStream class

的方法

来自 Javadocs:

Write the specified object to the ObjectOutputStream. The class of the object, the signature of the class, and the values of the non-transient and non-static fields of the class and all of its supertypes are written.

声明是什么

The class of the object

是什么意思?这是否意味着将 .class 文件写入文件或 class 的源代码或仅写入 class 的名称?

class 的名称,以便当 ObjectInputStream 读回它时它知道要实例化什么 class。它不需要 class 的源代码,只需要它的名称。