Here is a snippet of code.
File dir = new File("dir"); dir.mkdir(); File file = new File(dir,"file.txt"); try { file.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
I want to know why exception handling is not required during dir.mkdir() , when only file.createNewFile() is required.
Are we very sure that “nothing happened” when creating the catalog? If so, what are the reasons?
java file file-io
Abhishek singh
source share