统计指定文件内文件数目和java行数代码
public static void main(String[] args) throws FileNotFoundException {
File v =new File("D:\\jdk\\jdk\\jdk-17");
count(v);
System.out.println(rows);
System.out.println(filecount);
}
public static void count(File file) throws FileNotFoundException {
for (File t : file.listFiles()) {
if (t.isDirectory()) {
count(t);
} else if (t.isFile() && t.getName().toLowerCase().endsWith(".java")) {
++filecount;
rows += rows(t);
}
}
}
//读出java文件的行数
pu