I am storing a class object into a string using toString() method. Now, I want to convert the string into that class object.
How to do that? Please help me with source code.
解决方案
I am storing a class object into a string using toString() method. Now, I want to convert the string into that class object.
Your question is ambiguous. It could mean at least two different things, one of which is ... well ... a serious misconception on your part.
If you did this:
SomeClass object = ...
String s = object.toString();
then the answer is that there is no simple way to turn s back into an instance of SomeClass. You couldn do it even if the toString() method gave you one of those funky "SomeClass@xxxxxxxx" strings. (That string does not encode the state of the object, or even a reference to the object. The xxxxxxxx part is