package FileIO;
import java.io.File;
import java.io.IOException;
public class Fle {
public static void main(String[] args) throws IOException {
File b = new File("E:\\Fanew\\java.txt");
System.out.println(b.createNewFile());
File b1 = new File("E:\\Fanew\\Jaks");
System.out.println(b1.mkdir());
System.out.println("--------");
File f = new File("xuexi\\java.txt");
System.out.println(f.isDirectory());
System.out.println(f.isFile());
System.out.println(f.exists());
System.out.println(f.getAbsoluteFile());
System.out.println(f.getName());
System.out.println("--------");
File f2=new File("E:\\Fanew");
String[] list = f2.list();
for(String a:list){
System.out.println(a);
System.out.println("---------");
File f3=new File("xuexi\\tew");
// System.out.println(f3.createNewFile());
System.out.println(f3.delete());
File f4=new File("xuexi\\iste");
System.out.println(f4.mkdir());
File f5=new File("xuexi\\iste\\java.txt");
System.out.println(f5.createNewFile());
System.out.println(f5.delete());
System.out.println(f4.delete());
}
}
} |
|