add files

This commit is contained in:
2026-05-10 16:35:22 +03:30
parent f29dc564fb
commit 42f07c638d
14 changed files with 420 additions and 0 deletions
@@ -0,0 +1,20 @@
package org.FileExamples.DeletingFiles;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
public class DeleteFileExample02 {
static void main() {
try
{
Path path = Path.of("example.txt");
Files.deleteIfExists(path);
System.out.println("File deleted if it existed.");
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
}