本帖最后由 HM马强 于 2013-9-27 19:24 编辑
- package demo;
- import java.lang.reflect.Constructor;
- import java.lang.reflect.Proxy;
- import java.util.Collection;
- public class ProxyTest {
- public static void main(String[] args) {
- Class clazzProxy1 = Proxy.getProxyClass(
- Collection.class.getClassLoader(), Collection.class);
- System.out.println(clazzProxy1.getName());
-
- System.out.println("---------------------------");
- Constructor[] constructors = clazzProxy1.getConstructors();
- for (Constructor constructor : constructors) {
- String name = constructor.getName();
- StringBuilder sb = new StringBuilder(name);
- sb.append('(');
- Class[] clazzParams = constructor.getParameterTypes();
- for (Class clazzParam : clazzParams) {
- sb.append(clazzParam.getName());
- }
- if (clazzParams != null && clazzParams.length != 0)
- sb.deleteCharAt(sb.length() - 1);
- sb.append(')');
- System.out.println(sb);
- }
- }
- }
复制代码 请问一下大神,我这代码怎么运行结果和老师的不一样啊?
我怎么也看不出来问题在哪...- com.sun.proxy.$Proxy0
- ---------------------------
- com.sun.proxy.$Proxy0(java.lang.reflect.InvocationHandle)
复制代码 我的运行结果是这样子的.
|
|