摘要: centos7下源码安装多个nginx步骤完整版 1.下载:wget http://nginx.org/download/nginx-1.8.1.tar.gz 解压:tar -zxvf nginx-1.8.1.tar.gz 2.执行下面的命令安装nginx的依赖库: yum -y install g 阅读全文
posted @ 2020-06-25 15:34 散落人间 阅读(1654) 评论(0) 推荐(0) 编辑
interface food{} class A implements food{} class B implements food{} class C implements food{} public class StaticFactory { private StaticFactory(){} public static food getA(){ return new A(); } public static food getB(){ return new B(); } public static food getC(){ return new C(); } } class Client{ //客户端代码只需要将相应的参数传入即可得到对象 //用户不需要了解工厂类内部的逻辑。 public void get(String name){ food x = null ; if ( name.equals("A")) { x = StaticFactory.getA(); }else if ( name.equals("B")){ x = StaticFactory.getB(); }else { x = StaticFactory.getC(); } } }