### Question:
CollectionGenericEssence { public ArrayList<String> addElementsByMethodReflect(ArrayList<String> arrayList, Object value) { Class arrayListClass = arrayList.getClass(); try { Method method = arrayListClass.getMethod("add", Object.class); method.invoke(arrayList, value); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return arrayList; }  static void main(String[] args); ArrayList<String> addElementsByMethodReflect(ArrayList<String> arrayList, Object value); @Override String toString();  }### Answer:
@Test public void testAddElementsByMethodReflect() throws Exception { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("andy"); arrayList = collectionGenericEssence.addElementsByMethodReflect(arrayList, 10); while (arrayList.iterator().hasNext()) { System.out.println(arrayList.iterator().next()); } }