Java 实例 - 输出指定目录下的所有文件
Java 教程
· 2019-02-11 08:14:14
以下实例演示了如何使用 File 类的 list 方法来输出指定目录下的所有文件:
Main.java 文件
class Main {
public static void main(String[] args) {
File dir = new File("C:");
String[] children = dir.list();
if (children == null) {
System.out.println( "目录不存在或它不是一个目录");
}
else {
for (int i=0; i< children.length; i++) {
String filename = children[i];
System.out.println(filename);
}
}
}
}
以上代码运行输出结果为:
build build.xml destnfile detnfile filename manifest.mf nbproject outfilename src srcfile test
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
Effective C++
梅耶 (Scott Meyers) / 侯捷 / 电子工业出版社 / 2011-1-1 / 65.00元
《Effective C++:改善程序与设计的55个具体做法(第3版)(中文版)(双色)》内容简介:有人说C++程序员可以分为两类,读过Effective C++的和没读过的。世界项级C++大师scott Meyers成名之作的第三版的确当得起这样的评价。当您读过《Effective C++:改善程序与设计的55个具体做法(第3版)(中文版)(双色)》之后,就获得了迅速提升自己C++功力的一个契机......一起来看看 《Effective C++》 这本书的介绍吧!