本帖最后由 jx5785749 于 2015-7-17 22:57 编辑
package cn.itcast.test01;
import java.io.File;
public class Test05 {
public static void main(String[] args) {
File file = new File("D:\\");
showFiles(file);
}
private static void showFiles(File file) {
// TODO Auto-generated method stub
File[] fileArrays = file.listFiles();
if (fileArrays != null) {
for (File f : fileArrays) {
if (f.isDirectory()) {
showFiles(f);
} else {
if(f.getName().endsWith(".java"))
{
System.out.println(f.getAbsolutePath());
}
}
}
}
}
} |
|