[Java] package com. pzf; import java. lang. reflect. constructor; import java. lang. reflect. method; import java. lang. reflect. proxy; import java. util. collection;/* create a dynamic class and view its method list information */public Class ProxyTest {public static void main (String [] args) {class clazzProxy1 = Proxy. getProxyClass (Collection. class. getClassLoader (), Collection. class); // parameter class 1 loader, class 2 interface (multiple) System. out. println (clazzProxy1.getName (); // 2, View the class method // 2.1 view the constructor System. out. println ("---- Constructor list ----"); Constructor [] constructors = clazzProxy1.getConstructors (); for (constructor: constructors) {// obtain the Constructor name String name = Constructor. getName (); StringBuilder sb = new StringBuilder (name); sb. append ('); // view the method parameter Class [] clazzParames = constructor. getParameterTypes (); for (Class clazzParame: clazzParames) {// retrieve the type name and append it to StringBuilder. Each parameter Use commas to separate sb. append (clazzParame. getName (). append (",") ;}// remove the last comma if (clazzParames! = Null & clazzParames. length! = 0) sb. deleteCharAt (sb. length ()-1); sb. append ('); System. out. println (sb. toString ();} System. out. println ("---- Method list ----"); Method [] methods = clazzProxy1.getMethods (); for (method: methods) {// obtain the name of the constructor String name = Method. getName (); StringBuilder sb = new StringBuilder (name); sb. append ('); // view the method parameter Class [] clazzParames = method. getParameterTypes (); for (Class clazzParame: clazzParames) {// retrieve the type name And append it to StringBuilder. Each parameter is separated by commas. append (clazzParame. getName ()). append (",") ;}// remove the last comma if (clazzParames! = Null & clazzParames. length! = 0) sb. deleteCharAt (sb. length ()-1); sb. append ('); System. out. println (sb. result: $ Proxy0 ---- constructor list ---- $ Proxy0 (java. lang. reflect. invocationHandler) ---- method list ---- add (java. lang. object) hashCode () clear () equals (java. lang. object) toString () contains (java. lang. object) isEmpty () addAll (java. util. collection) iterator () size () toArray ([Ljava. lang. object;) toArray () remove (java. lang. object) containsAll (java. util. collection) removeAll (java. util. collection) retainAll (java. util. collection) isProxyClass (java. lang. class) getProxyClass (java. lang. classLoader, [Ljava. lang. class;) getInvocationHandler (java. lang. object) newProxyInstance (java. lang. classLoader, [Ljava. lang. class;, java. lang. reflect. invocationHandler) wait (long, int) wait (long) getClass () y () notifyAll ()