黑马程序员技术交流社区
标题:
在Interger泛型的list集合中存储String类型
[打印本页]
作者:
world.net
时间:
2015-6-17 23:19
标题:
在Interger泛型的list集合中存储String类型
public class insertStrToArray {
public static void main(String[] args) throws Exception {
ArrayList<Integer> list = new ArrayList<Integer>();
Method methodAddString = list.getClass().getMethod("add", Object.class);
methodAddString.invoke(list, "abc");
System.out.println(list);
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2