Java 实例 - 在指定目录中查找文件
Java 教程
· 2019-02-11 06:56:36
以下实例演示了使用 File 类的 dir.list() 方法在指定目录中查找所有文件列表:
Main.java 文件
import java.io.File;
public class Main {
public static void main(String[] argv) throws Exception {
File dir = new File("../java");
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);
}
}
}
}
以上代码运行输出结果为:
Car.class FileUtil.class FileUtil.java HelloWorld.class HelloWorld.java HelloWorldDebug.class HelloWorldDebug.java ……
点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html
Host Your Web Site In The Cloud
Jeff Barr / SitePoint / 2010-9-28 / USD 39.95
Host Your Web Site On The Cloud is the OFFICIAL step-by-step guide to this revolutionary approach to hosting and managing your websites and applications, authored by Amazon's very own Jeffrey Barr. "H......一起来看看 《Host Your Web Site In The Cloud》 这本书的介绍吧!
html转js在线工具
html转js在线工具
RGB CMYK 转换工具
RGB CMYK 互转工具