Creating a File

try { File file = new File("filename"); // Create file if it does not exist boolean success = file.createNewFile(); if (success) { // File did not exist and was created } else { // File already exists } } catch (IOException e) { }

Comments

18 Apr 2010 - 4:16pm by Mark Siano (not verified)

Thanks. It helped!

12 May 2010 - 8:10pm by Anonymous (not verified)

thanx helped a lot

30 Jun 2010 - 6:06am by Anonymous (not verified)

should check for permissions

26 Aug 2010 - 8:07am by eKWUNIFE (not verified)

i WANT TO COMMENT TO CREATING A FILE.

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.