File基本操作

This commit is contained in:
2024-12-09 08:57:54 +08:00
parent 01d80d8ad2
commit 2852b5f178
3 changed files with 105 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package chapter7;
import java.io.File;
public class Example03 {
public static void main(String[] args) {
File file = new File("src/chapter7");
if (file.isDirectory()) {
System.out.println("是目录");
String[] names = file.list();
for (String name : names) {
System.out.println(name);
}
}
}
}