/*
* 放射的实例,越过泛型检查
* 定义一个泛型为Integer的ArrayList数组,插入一个字符串
* (老子没事做,辛辛苦苦的定了个规则还TMD想越过它......)
*
*
*
*
* */
public class StaticDome {
public static void main(String[] args) throws NoSuchMethodException,
SecurityException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
// System.out.println("a");
ArrayList <Integer> list= new ArrayList<Integer>();
//Method addString("add",Object.class);
Method method=list.getClass().getMethod("add", Object.class);
method.invoke(list, "我是字符串 联通");
System.out.println(list.get(0));
}
}
|
|