How to create a new instance of a class with a certain constructor dynamically
<p>package company;</p>

<pre><code>public abstract class A {
    public A(int i) {}
    public abstract void func();

}

public class B extends A {
   public B(int i) { super(i); }
   public void func() {}
}


public class C extends A {
   public C(int i) { super(i); }
   public void func() {}
}
</code></pre>

<p>How do I dynamically instantiate company.C or company.B by invoking the constructor function (with a certain integer argument) and invoking the func() method? I know we can use the following <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getConstructors%28%29" rel="nofollow">method</a> and pass an argument, but not sure how to invoke func() method on it.</p>
