We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 687ec53 commit a993fa8Copy full SHA for a993fa8
JavaBase/src/com/xinan/io/TestFile01.java
@@ -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