Serialization of anonymous class in Java

前端 未结 4 1890
醉话见心
醉话见心 2021-01-12 12:59

Is it possible to searialize/desearialize anonymous class in Java?

Example:

ByteArrayOutputStream operationByteArrayStream = new ByteArrayOutputStrea         


        
4条回答
  •  余生分开走
    2021-01-12 13:43

    It is possible, by dangerous. The name/number of anonymous classes is generated by the compiler and is based on the order they appear in the file. e.g. if you swap the order of two classes, their names will swap as well. (Classes are deserialized by name)

提交回复
热议问题