title: Dynamic class declare and instantiate?
body: <p>Is it possible in java to declare and instantiate a class at runtime?</p>
  
  <p>I am attempting following code:</p>
  
  <pre><code>    public static void t4() {
      Object o = new Object() {
          private String uid = "1";
          private String name = "2";
  
          public String getName() {
              return name;
          }
  
          public String getUid() {
              return uid;
          }
  
          public void setName(String name) {
              this.name = name;
          }
  
          public void setUid(String uid) {
              this.uid = uid;
          }
  
          @Override
          public String toString() {
              return uid + " " + name;
          }
      };
  </code></pre>
  
  <p>But, I would want this to happen using reflection, cause i will be injecting attributes into pojo from xml source.</p>
  
  <p>Any more thoughts?</p>