抽象工厂模式
工厂方法模式
简单工厂模式
享元模式
装饰者模式
代理模式
组合模式
适配器模式
菜鸟教程笔记-计算机读取SD卡例子
先模拟计算机读取SD卡:
1、先创建一个SD卡的接口:
public interface SDCard { |
2、创建SD卡接口的实现类,模拟SD卡的功能:
public class SDCardImpl implements SDCard { |
3、创建计算机接口,计算机提供读取SD卡方法:
public interface Computer { |
4、创建一个计算机实例,实现计算机接口,并实现其读取SD卡方法:
public class ThinkpadComputer implements Computer { |
5、这时候就可以模拟计算机读取SD卡功能:
public class ComputerReadDemo { |