代码示例:123456789101112131415161718192021222324interface NetWork{ public void browse();}//被代理类class Server implements NetWork{ public void browse(){ System.out.println("真实的服务器访问网络"); }}//代理类class ProxyServer implements NetWork{ private NetWork work; public ProxyServer(NetWork work){ this.work = work; } public void chek(){ System.out.println("联网之前的检查工作"); } public void browse(){ chec(); work.browse(); }}1234567public class ProxyTest { public static void main(String[] args) { Server server = new Server(); ProxyServer pro = new ProxyServer(server); pro.browse(); }}运行结果