title: How to access class fields of a class that I only know it by its string name?
body: <p>For instance, I have a class called "My_Class_X123.java" like this :</p>
  
  <pre><code>public class My_Class_X123    // This file was generated by a java program
  {
    static String ABC[]={"1","2",...};
    int XYZ=0;
  }
  </code></pre>
  
  <p>When I wrote my program I didn't know there would be a class by this name, but at run time I found out a class by the name of "My_Class_X123.java" exists and I want to use its fields such as ABC and XYZ above, how to get those values ?</p>
  
  <hr>
  
  <p>OK, I got the answer, it's something like this :</p>
  
  <pre><code>  try
    {
      Class myClass=Class.forName("My_Class_X123");
      Field fields[]=myClass.getDeclaredFields();
      String New_ABC[]=String[].class.cast(fields[0].get(String[].class));
    }
    catch (Exception e) { e.printStackTrace(); }
  </code></pre>
  
  <p>Wouldn't it be nice to have some sample code like this in the java doc, to show user how to do it !</p>
  
  <p>Frank</p>