调用
Class.getConstructor(),然后
Constructor.newInstance()传递适当的参数。样例代码:
import java.lang.reflect.*;public class Test { public Test(int x) { System.out.println("Constuctor called! x = " + x); } // Don't just declare "throws Exception" in real pre! public static void main(String[] args) throws Exception { Class<Test> clazz = Test.class; Constructor<Test> ctor = clazz.getConstructor(int.class); Test instance = ctor.newInstance(5); }}


