package com.itheima;
import java.lang.reflect.Method;
import java.util.ArrayList;
public class Test2 {
public static void main(String[] args) throws Exception{
ArrayList<Integer> list = new ArrayList<Integer>();
Method methodAdd = list.getClass().getMethod("add",Object.class);
methodAdd.invoke(list,"String");
System.out.println(list);
}
}
入学考试题 |