⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 command.java

📁 现在在国外大学里最流行的java学习软件,同时还有大量的example,在名为project的文件里.安装好后用bluej打开peoject的例子,可以进行你想要的任何变化.同时可以了解大量的源码
💻 JAVA
字号:
/** * This class is part of the "World of Zuul" application.  * "World of Zuul" is a very simple, text based adventure game.   * * This class holds information about a command that was issued by the user. * A command currently consists of two strings: a command word and a second * word (for example, if the command was "take map", then the two strings * obviously are "take" and "map"). *  * The way this is used is: Commands are already checked for being valid * command words. If the user entered an invalid command (a word that is not * known) then the command word is <null>. * * If the command had only one word, then the second word is <null>. *  * @author  Michael Kolling and David J. Barnes * @version 2006.03.30 */public class Command{    private String commandWord;    private String secondWord;    /**     * Create a command object. First and second word must be supplied, but     * either one (or both) can be null.     * @param firstWord The first word of the command. Null if the command     *                  was not recognised.     * @param secondWord The second word of the command.     */    public Command(String firstWord, String secondWord)    {        commandWord = firstWord;        this.secondWord = secondWord;    }    /**     * Return the command word (the first word) of this command. If the     * command was not understood, the result is null.     * @return The command word.     */    public String getCommandWord()    {        return commandWord;    }    /**     * @return The second word of this command. Returns null if there was no     * second word.     */    public String getSecondWord()    {        return secondWord;    }    /**     * @return true if this command was not understood.     */    public boolean isUnknown()    {        return (commandWord == null);    }    /**     * @return true if the command has a second word.     */    public boolean hasSecondWord()    {        return (secondWord != null);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -