ls.java
来自「用command模式写的一个简单的java 程序」· Java 代码 · 共 31 行
JAVA
31 行
/******************************************************************************* Filename :ls.java
* Description :ls command
*
* Author :xunzy
*
* History :2004-02-16 Created******************************************************************************/import java.util.Vector;import java.io.*;public class ls implements Command { public void execute(File c, Vector v) throws CommandException { // Check for current dir; throw an exception if there is null if (FileSystemShell.getCurrentDir() == null) throw new CommandException(new Exception(), "Error: no current context."); // Call list() and then loop through the results, printing the names String[] enum = c.list(); int i=0; while (i<enum.length) { System.out.println(enum[i]); i++; } } public void help() { System.out.println("Usage: list [dirName]"); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?