Skip to content

Commit a993fa8

Browse files
author
xiachaochao
committed
123
1 parent 687ec53 commit a993fa8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.xinan.io;
2+
3+
import java.io.File;
4+
import java.io.IOException;
5+
6+
public class TestFile01 {
7+
public static void main(String[] args) throws IOException{
8+
File f1=new File("java宝典0");//创建新的file对象
9+
System.out.println(f1);
10+
System.out.println(f1.getAbsolutePath());
11+
if(!f1.exists()){
12+
f1.createNewFile();//这个需要是空括号,执行创建新文件的功能
13+
}else{
14+
f1.delete();
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)