package staticProxy;public class StaticProxy { public static void main(String[] args) { Object proxyObject = new ProxyObject(); proxyObject.action(); }}interface Object{ void action();}//代理类class ProxyObject implements Object{ Object obj; public ProxyObject() { obj = new ObjectImpl(); System.out.println("代理类创建成功"); } @Override public void action() { System.out.println("代理类开始执行"); obj.action(); System.out.println("代理类执行完毕"); }}//被代理类class ObjectImpl implements Object{ @Override public void action() { System.out.println("被代理对象开始执行"); System.out.println("被代理对象执行完毕"); }}