feat: complete all files

This commit is contained in:
2026-05-15 17:30:41 +03:30
parent 42f07c638d
commit 51cccccea4
9 changed files with 61 additions and 93 deletions
@@ -5,39 +5,21 @@ import java.io.IOException;
public class CreateFileExample01 {
static void main() {
File file = new File("quotes.txt");
try {
File file = new File("texts/examples.txt");
try
{
if(file.createNewFile())
{
System.out.println("created new file");
System.out.println("File created");
}
else
{
System.out.println("file already exists");
System.out.println("File already exists");
}
} catch (IOException e) {
System.err.println(e.getMessage());
}
File newfile = new File("newfolder/quotes.txt");
try {
newfile.getParentFile().mkdirs();
if(newfile.createNewFile())
{
System.out.println("created new file");
}
else
{
System.out.println("file already exists");
}
} catch (IOException e) {
catch(IOException e)
{
System.err.println(e.getMessage());
}
}
//TODO: 1. Create File
//TODO: 2. Specify and address and directory that exists
//TODO: 3. Specify and address and directory that does not exists
//TODO: 4.
}