finddirectories.java
来自「《Core Java2 Volume I-5e》 源码」· Java 代码 · 共 32 行
JAVA
32 行
/**
* @version 1.00 05 Sep 1997
* @author Gary Cornell
*/
import java.io.*;
public class FindDirectories
{ public static void main(String[] args)
{ if (args.length == 0) args = new String[] { ".." };
try
{ File pathName = new File(args[0]);
String[] fileNames = pathName.list();
for (int i = 0; i<fileNames.length; i++)
{ File tf = new File(pathName.getPath(),
fileNames[i]);
if (tf.isDirectory())
{ System.out.println(tf.getCanonicalPath());
main(new String [] { tf.getPath() });
}
}
}
catch(IOException e)
{ System.out.println("Error: " + e);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?