Class cls=Class.forName("test.reflect.A"); //import class Constructor cst=cls.getConstructor(new Class[]{String.class}); //get the constructor Object obj=cst.newInstance(new Object[]{new String("invoke Construct method!")}); //get a new instance
Class cls=Class.forName("test.reflect.A"); //import class Constructor cst=cls.getConstructor(new Class[]{String.class}); //get the constructor Object obj=cst.newInstance(new Object[]{new String("invoke Construct method!")}); //get a new instance
Constructor cst=cls.getConstructor(new Class[]{String.class}); //get the constructor
Object obj=cst.newInstance(new Object[]{new String("invoke Construct method!")}); //get a new instance
Constructor cst=cls.getConstructor(new Class[]{String.class}); //get the constructor
Object obj=cst.newInstance(new Object[]{new String("invoke Construct method!")}); //get a new instance