向ArrayList list =new ArrayList<>();聚合中加入字符串元素
public class add {
public static void main(String[] args) throws Exception {
ArrayList<Integer> list =new ArrayList<>();
list.add(100);
list.add(200);
Class c2=list.getClass();
Method method=c2.getDeclaredMethod("add", Object.class);
method.invoke(list,"小夏同学");
System.out.println(list);
}
}