import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* @author duhaoyu
* @date 2020/11/24 21:34
*
* 给你一个List<Integer>的对象,如何存储一个字符串类型的数据?
*/
public class Test06 {
public static void main(String[] args) throws Exception {
List<Integer> list = new ArrayList<>();
Class<?> c = list.getClass();
Method method = c.getMethod("add",Object.class);
method.invoke(list,"hello");
System.out.println(list);
}
}