import java.io.File;
Import the Java. IO. IOException;
Public class FileTest {
Public static void main (String [] args) {
The File File=new File (" D: \ \ TGG text ");
If (the file. The exists ()) {
File. The delete ();
System. The out. Println (" the file has been deleted ");
} else {
Try {
File. CreateNewFile ();
System. The out. Println (" file has been created ");
} the catch (IOException e) {
e.printStackTrace();
}
}
}
}
when I set the TXT file format, why the computers will be found to open it? File size also show 0 KB,,
CodePudding user response:
You just create a file, there is no file is written to the information, so, of course, is an empty file is 0 bytesCodePudding user response:
Can't open, you use notepad to open the right-click,Size is zero, because didn't write anything,
Code logic, also do not conform to the common sense,
CodePudding user response:
Why the suffix is text, customCodePudding user response: