rundebugtest.java

来自「此为java开发方面的算法」· Java 代码 · 共 41 行

JAVA
41
字号
/****************************************************
 * 参考书籍:<<Java面向对象编程>>                   *
 * 技术支持网址:www.javathinker.org                *
 ***************************************************/

package reflect.sample;

import java.lang.reflect.*;

public class RunDebugTest
{
    public static void main(String[] args)
    {
        try
        {
// Create the real interface implementation
            TestTarget target = new TestTarget();

// Create a proxy to wrap the original implementation
            DebugProxy proxy = new DebugProxy(target);


// Get a reference to the proxy through the TestInterface interface
         /*   TestInterface test = (TestInterface) Proxy.newProxyInstance(
                TestInterface.class.getClassLoader(),
                new Class[] { TestInterface.class }, proxy);*/

            TestInterface test=target;

// Invoke some methods on the test interface
            System.out.println(test.doTest1("This is test ", 1));
            test.doTest2(new String[] { "foo", "bar", "baz" });
        }
        catch (Exception exc)
        {
            exc.printStackTrace();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?