package org.FileExamples.CreatingFiles; import java.io.File; import java.io.IOException; public class CreateFileExample01 { static void main() { File file = new File("quotes.txt"); try { if(file.createNewFile()) { System.out.println("created new file"); } else { 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) { 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. }