Java 求大神帮忙!!求代码

2024-12-27 17:04:02
推荐回答(1个)
回答1:

代码如下:

import java.io.File;

public class FileTest {

public static void main(String[] args){
File file = new File("C:\\");
File[] files = file.listFiles();
for (int i=0;iif(files[i].isDirectory()){
System.out.println("<" + files[i].getName() + ">");
}else {
System.out.println(files[i].getName() + "  " + files[i].length());
}
}
}
}

如果有帮助到你,请点击采纳