适配器模式就是 将一个类的接口转换成客户希望的另外一个接口。从而复用旧类的功能,
1 public class Adapter { 2 3 public static void main(String[] args) { 4 Network n = new CiscoNetworkAdapter(); 5 n.download(); 6 } 7 } 8 9 interface Network { 10 void download(); 11 } 12 13 class CiscoNetworkAdapter implements Network { 14 15 private Cisco cisco = new Cisco(); 16 17 @Override 18 public void download() { 19 cisco.download(); 20 } 21 } 22 23 class Cisco { 24 void download() { 25 System.out.println("download with cisco"); 26 } 27 }