What are the internal details of the conversion between custom objects and Object?

  1. when learning ObjectInputStream mainly, I don"t understand the process of reading and writing. Object conversion to word energy saving understanding, but how can the conversion of objects into object, ensure the correctness of the data? What are the internal details of the conversion between custom objects and Object?

2. My own thinking: I guess that the .class of each object will be saved in object, and the specific data in the object will be converted according to .class.
this .class is the key to the transformation.

3. After asking: object refers to an instance of this object (class can be thought of as a mold. The example is something produced according to the mold. )

4. Personal understanding of this: that is, an instance reference of this object will be maintained in object, and there is some specific data about this object in the instance. If you need to convert the object from object, create a new object based on the reference of this instance?

5. One last question: if I customize an object and convert it to a reference that maintains an instance of the object in Object,Object, then I start serializing and writing out, is the object still there? If it is not maintained, how can I create an object based on this reference the next time I deserialize?

ps: let"s discuss it. I, rookie, don"t understand a lot of things. Please

Aug.15,2021

After looking at it for a long time, I probably understand your intention.
I borrow the contents of Chapter 1, Section 5 of Java Core Technology Volume 2 to answer:

when an object is stored, the class to which the object belongs must also be stored, and the description of this class contains:

  • Class name
  • The only ID, in the serialized version of
  • is the fingerprint of the data type and method signature, which is your common private static final long serialVersionUID = 1L;
  • Flag set describing serialization methods
  • description of the data domain

what exactly is serialized into the file, refer to this book, write very clearly.

when your Person object is strongly converted to Object type, and then in the serialized output, the output contains the class name Person .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3515a-2bf4a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3515a-2bf4a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?