public static void main(String[] args) throws Exception
{
ArrayList<String > al=new ArrayList<>();
al.add("字符");
Class clazz=al.getClass();
Method method=clazz.getMethod("add",Object.class);
method.invoke(al, 1223);
for (Object obj : al) {
System.out.println(obj.toString());
}
} |
|