代码如下:
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;i
System.out.println("<" + files[i].getName() + ">");
}else {
System.out.println(files[i].getName() + " " + files[i].length());
}
}
}
}
如果有帮助到你,请点击采纳