1 Star 0 Fork 3

luyu/JavaDesigner

forked from serv/JavaDesigner 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Factory.java 767 Bytes
一键复制 编辑 原始数据 按行查看 历史
serv 提交于 2014-04-08 11:42 +08:00 . init
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: The9.com</p>
* @author Jerry Shen
* @version 0.5
*/
public class Factory {
public Window CreateWindow (String type) {
if(type.equals("Big")) {
return new WindowBig();
} else if(type.equals("Small")) {
return new WindowSmall();
} else {
return new WindowBig();
}
}
// The Main function only for our test
public static void main(String[] args) {
Factory myFactory = new Factory();
Window myBigWindow = myFactory.CreateWindow("Big");
myBigWindow.func();
Window mySmallWindow = myFactory.CreateWindow("Small");
mySmallWindow.func();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/luyu/JavaDesigner.git
git@gitee.com:luyu/JavaDesigner.git
luyu
JavaDesigner
JavaDesigner
master

搜索帮助