add files
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package org.FileExamples.DeletingFiles;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class DeleteFileExample01 {
|
||||
static void main() {
|
||||
File file = new File("example.txt");
|
||||
|
||||
if (file.delete()) {
|
||||
System.out.println("Deleted file: " + file.getName());
|
||||
} else {
|
||||
System.out.println("Failed to delete the file.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user