package demo7;

import java.io.File;

public class demofile {
    public static void main(String[] args) {
        File f1 = new File("./");
        getAllFile(f1);

    }

    private static void getAllFile(File dir) {
        File[] files = dir.listFiles(pathname -> pathname.isDirectory() || pathname.getName().toLowerCase().endsWith(".java"));
        for (File f:files
             ) {
            if(f.isDirectory()){
                getAllFile(f);
            }else {
                System.out.println(f);
            }
            
        }
    }
}

 

相关文章:

  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2021-05-17
  • 2022-12-23
  • 2022-01-03
  • 2021-11-29
猜你喜欢
  • 2021-12-26
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案