设计模式:简单工厂
简单工厂就是把if-else语句放到了Factory中,代码如下:
package com.zsk.pattern.simpleFactory;public class TestSimpleFactory {public static void main(String[] args) {// TODO Auto-generated method stubMobileFactory mobileFactory = new MobileFactory();Mobile mobile = mobileFactory.CreateMobile("CDMA");mobile.prepare();mobile.box();mobile.sell();}}