代理模式
package test;//主题=代理主题(真实主题) interface Subject{ }class RealSubject implements Subject{ }class ProxySubject{ private Subject subject; public ProxySubject(){} public ProxySubject(Subject subject){ this.subject=subject; } public void start(){ System.out.println("启动"); }} public class Dailimoshi { public static void main(String[] args) { Subject realSubject=new RealSubject(); new ProxySubject(realSubject).start(); }}