Sunday, 25 August 2013
File not deleting
File not deleting References So, I am trying to delete a file, but it doesn\'t let me... here is my code: private static final File file = new File(\"data.dat\"); public static void recreate() { try { if (file.exists()) { file.delete(); } if (file.exists()) { throw new RuntimeException(\"Huh, what now?\"); } file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } As is not suspected, it throws the exception: Exception in thread \"main\" java.lang.RuntimeException: Huh, what now? Any help? What am I doing wrong (It probably is just a derp...)?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment