工厂方法是用的最多的设计模式,所以今天再深入的学习。 package com.factorydemo.www; public class Factory { public static void main(String[] args){ /*Car car = null; CarFactory c = new CarFactory(); car = c.getCarInstance("Benz"); if(c!=null) { car.run(); car.stop(); } else { System.out ...
package com.factory.www; public class Factory { public static void main(String[] args){ /*car c = new Benz(); c.run(); c.stop(); car c1= new Ford(); c1.run(); c1.stop();*/ car c =FactoryInstance.getCarInstance(); c.run(); c.stop(); } } interface car{ ...
BEA
搜索本博客
我的相册
C185a0b8-90cb-37ce-9140-04449c6497bf-thumb
427531f9-950e-4e4d-88b6-8d1ef3df545f
共 88 张
存档
最新评论