ClassLoader loader= Thread.currentThread().getContextClassLoader();
Class clz = loader.loadClass("com.easeye.test.Student"); Constructor[] con= clz.getConstructors(); //Student stu = (Student) con[0].newInstance("ST001","陈文光",30); // stu.ShowInfo(); Object stu = con[0].newInstance("ST001","陈文光",30); Method method1 =clz.getDeclaredMethod("ShowInfo"); method1.invoke(stu); Method method2 = clz.getDeclaredMethod("Say", java.lang.String.class,java.lang.Integer.class); method2.invoke(stu, "大家好",1);