public class MyProxy
{
public static void main(String[]args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
{
Class clazzProxy=Proxy.getProxyClass(Collection.class.getClassLoader(), Collection.class);
System.out.println(clazzProxy.getName());
Constructor constructor=clazzProxy.getClass().getConstructor(InvocationHandler.class);
}
}
怎么输出结果老是
$Proxy0
Exception in thread "main" java.lang.NoSuchMethodException: java.lang.Class.<init>(java.lang.reflect.InvocationHandler)
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getConstructor(Class.java:1657)
at cn.itcast.day3.MyProxy.main(MyProxy.java:17)