package cn.IO;
import java.io.File;
public class File1 {
public static void main(String[] args) {
File f1=new File("f:\\filetest", "1.txt");
File f2=new File("f:\\filetest", "2.txt");
File f3=new File("f:\\filetest", "3.txt");
File f4=new File("f:\\filetest", "4.txt");
File f5=new File("f:\\filetest", "5.txt");
File f6=new File("f:\\filetest", "6.txt");
File f7=new File("f:\\filetest", "7.txt");
File f8=new File("f:\\filetest");
try {
f1.createNewFile();
f2.createNewFile();
f3.createNewFile();
f4.createNewFile();
f5.createNewFile();
f6.createNewFile();
f7.createNewFile();
} catch (Exception e) {
}
File[]ff=f8.listFiles();
//for (int i=0;i<ff.length;i++) {
// System.out.println("文件名:"+ff[i]);
//}
for (File file : ff) {
System.out.println("文件名:"+file);
}
}
}
|
|