package cn.itcast;
import java.io.File;
public class Demo3 {
public static void main(String[] args) {
File file = new File("src/cn/itcase");
File[] listFiles = file.listFiles();
for (File file1 : listFiles) {
if (file.isFile()) {
String name = file.getName();
if (name.endsWith(".java")) {
System.out.println(file);
}
}
}
}
}
|
|