- 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);
复制代码 |
|