?? fruitgardener.java
字號(hào):
//Source file: D:\\javaproject\\DesignPattern\\StaticFactoryPattern\\FruitGardener.java
public class FruitGardener
{
/**
* @param which
* @throws BadFruitException
* @roseuid 41A09922001F
*/
public static Fruit Fruitfactory(String which) throws BadFruitException
{
if(which.equalsIgnoreCase("apple"))
{
return new Apple();
}
else if(which.equalsIgnoreCase("strawberry"))
{
return new Strawberry();
}
else if(which.equalsIgnoreCase("grape"))
{
return new Grape();
}
else
{
throw new BadFruitException("Bad fruit request");
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -