提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
枚举类型实现命令界面
/** from n o w j a v a . c o m - 时代Java**/ enum CommandList implements Command { RUN { public void execute() { System.out.println("Running..."); } }, JUMP { public void execute() { System.out.println("Jumping..."); } }; public abstract void execute(); } interface Command { void execute(); } public class Main { public static void main(