Casting Class into String and vice versa in Java
<p>I have a program in which I need to store a Class object into memory by casting it into String. Is it possible to convert the String back into the original Class so that I can use that class variables? I am doing this in JAVA.</p>

<p>Example: test.java</p>

<pre><code>class hello{
 public String h1;
 public String h2;
}
public class test {

 public static void main(String[] args)
 {
   hello h = new hello();

   h.h1 = "hello";
   h.h2 = "world";

   String s = h.toString();
   System.out.println("Print s : "+s);

   // Now I need to convert String s into type hello so that 
          // I can do this:
          // (hello)s.h1;
          // (hello)s.h2;   
 } 
}
</code></pre>

<p>NOTE: this is not a homework, this is a personal project and I would  be grateful if anyone can help! </p>

<p>Thanks!
Ivar</p>
