`

文件过滤 FileNameFileter

阅读更多

 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 结尾的文件

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics