public static void main(String[] args) throws IOException {
File dir =new File("src/common");
File path = dir.getAbsoluteFile();
File[] files = dir.listFiles(new FilenameFilter(){
public boolean accept(File dir, String name) {
// TODO Auto-generated method stub
return name.endsWith(".java");
}
}) ;
System.out.println(files[0]);
}
过滤.name 结尾的文件