摘要: 1 package com.tn.策略模式; 2 3 public class Client { 4 private Strategy strategy; 5 public void setStrategy(Strategy strategy){ 6 this.strategy=strategy; 7 } 8 public voi... 阅读全文
posted @ 2017-05-10 20:45 xiongjiawei 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 1 public class Test { 2 public static void main(String[] args){ 3 Creator ca=new ConcreteCreatorA(); 4 ca.create().doSth(); 5 Creator cb=new ConcreteCreatorB(); 6 ... 阅读全文
posted @ 2017-05-10 16:35 xiongjiawei 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1 public class Test { 2 public static void main(String[] args){ 3 try{ 4 Factory.factory("A").doSth(); 5 Factory.factory("B").doSth(); 6 Factory.... 阅读全文
posted @ 2017-05-10 13:35 xiongjiawei 阅读(196) 评论(0) 推荐(0) 编辑