Java examples for File Path IO:File Operation
Creating a file and use if statement to check if the creation is successful
import java.io.File; import java.io.IOException; public class Main { public static void main(String[] arg) throws IOException { File f = new File("c:/myfile.txt"); if (f.createNewFile()) System.out.println("File created."); else/*from ww w . java 2 s . com*/ System.out.println("File could not be created."); } }