Converting back from toString to Object

前端 未结 7 1733
谎友^
谎友^ 2020-12-11 21:23

Is there any way to convert from toString back to the object in Java?

For example:

Map myMap = new HashMap

        
7条回答
  •  悲&欢浪女
    2020-12-11 22:07

    Short answer: no.

    Slightly longer answer: not using toString. If the object in question supports serialization then you can go from the serialized string back to the in-memory object, but that's a whole 'nother ball of wax. Learn about serialization and deserialization to find out how to do this.

提交回复
热议问题