/** * @author Rollen-Holt 设计模式之 適配器模式 */ interface window{ void open(); void close(); void activated(); void iconified(); } abstract class WindowAdapter{ public void open(){ } public void close(){ } public void activated(){ } public void iconified(){ } } class AdapterDemo extends WindowAdapter{ public void open(){ System.out.println("打开窗口"); } public void close(){ System.out.println("关闭窗口"); } } class hello{ public static void main(String[] a){ AdapterDemo a1=new AdapterDemo(); a1.open(); a1.close(); } }