import java.util.*; import java.lang.reflect.*; public class CSDN { public static void main(String args[]) throws Exception{ Set s = new HashSet(); s.add("foo"); Iterator it = s.iterator(); //Class[] argsClass = new Class[0]; Method m = it.getClass().getMethod("hasNext"); System.out.println(m.invoke(it)); } } 为什么运行会出现错误? |