Java examples for File Path IO:File Operation
Create new empty file
import java.io.*; public class Main { public static void main(String[] args) { File file = new File("C://demo.txt"); boolean blnCreated = false; try// w w w . j ava 2 s.c o m { blnCreated = file.createNewFile(); } catch(IOException ioe) { System.out.println("Error while creating a new empty file :" + ioe); } System.out.println("Was file " + file.getPath() + " created ? : " + blnCreated); } }