title: Creating class instance based on class type?
body: <p>I am using JAVA7. I have below class.</p>
  
  <pre><code>public class SomeClass&lt;B extends Base, L extends Last&gt;{
     Class&lt;L&gt; last;
     Class&lt;B&gt; base;
  
     public SomeClass(Class&lt;L&gt; last, Class&lt;B&gt; base){
         this.last=last;
         this.base=base;
     }
  }
  </code></pre>
  
  <p>here i need to create a method which will accept class type and create its instance  and return. how can i do that?</p>
  
  <p><code>public returnclassinstance createInstance(Class class)</code></p>
  
  <p>I would call this method by passing either last/base. This method has to create the instance of the passed class type and return the same. Is it possible?</p>
  
  <p>Thanks!</p>