5. //Proxy Pattern
public class Proxy implements Subject{
private Subject subject;
public Proxy(){
subject = new RealSubject();
}
public void doAction(){
...;
subject.doAction();
...;
}
}
//client for Proxy
public class Client{
public static void main(String[] args){
//the client doesn’t know the Proxy
//delegate another object
Subject subject = new Proxy();
...;
}
}