1 @Test
2 public void test7() throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException{
3
4 Class<?> Person = Class.forName("com.Person");
5 Object newInstance = Person.newInstance();
6 for (int i = 1; i < 4; i++) {
7 Method method = Person.getMethod("getPerson"+i, String.class);
8 String str2= (String) method.invoke(newInstance, new Object[]{i+""});
9 System.out.println(str2);
10 }
11 }