- public class Demo7 {
- public static void main(String[] args) throws Exception {
- Map<Integer,String> map=new HashMap<Integer,String>();
- map.put(1,"a");
- map.put(2,"b");
-
- Class s=map.getClass();
- Method m=s.getMethod("put",Object.class,Object.class);
- m.invoke(map, "333","c");
- //System.out.println(map.toString());
-
- Set<Map.Entry<Object,String>> set=map.entrySet();
- }
- }
复制代码 |
|