commandfactory.java
来自「采用面向对象方法和Java语言开发一个基于命令行交互方式的议程(agenda)管」· Java 代码 · 共 28 行
JAVA
28 行
package agenda;
/**
*@author haha
*/
public class CommandFactory {
static public Command getCommand(String cmd) throws InstantiationException, IllegalAccessException, ClassNotFoundException
{
//Command result =(Command)Class.forName(cmd).newInstance();
Command result;
if(cmd.equals("register"))
result = new register();
else if(cmd.equals("add"))
result = new add();
else if(cmd.equals("query"))
result = new query();
else if(cmd.equals("delete"))
result = new delete();
else if(cmd.equals("clear"))
result = new clear();
else
result = new register();
return result;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?