摘要:
```
package DesignPattern; public class AbstractFactory { public static class Dough{} public static class Sauce{} public static class Veggies{} public static class Cheese{} public... 阅读全文
posted @ 2019-04-17 16:24
Fake_coder
阅读(90)
评论(0)
推荐(0)
摘要:
``` package DesignPattern; import java.util.ArrayList; public class FactoryMethodPattern { / 工厂方法模式要点在于将创建方法设定为抽象方法,工厂类为抽象类 适用于不同的原料配置,自定义创建方法从而形成一类产品 阅读全文
posted @ 2019-04-17 16:23
Fake_coder
阅读(110)
评论(0)
推荐(0)
摘要:
```
package DesignPattern; public class SimpleFactoryPattern { public static class Pizza{ public String type="Pizza"; public void prepare(){} public void bake(){} ... 阅读全文
posted @ 2019-04-17 16:22
Fake_coder
阅读(104)
评论(0)
推荐(0)
摘要:
``` package DesignPattern; import java.util.ArrayList; public class ObserverPattern { //来自Head First 设计模式 interface Subject{ void registerObserver(Observer observer); void re... 阅读全文
posted @ 2019-04-17 16:22
Fake_coder
阅读(127)
评论(0)
推荐(0)
摘要:
``` package DesignPattern; public class StrategePattern { //来自HeadFirst设计模式 interface FlyBehavior{ //将飞行行为抽象为接口 void fly(); } interface QuackBehavior{ //将鸭子叫抽象... 阅读全文
posted @ 2019-04-17 16:21
Fake_coder
阅读(156)
评论(0)
推荐(0)