I would like to ask you heroes, how to create a file with a path in Java, indicating that the path does not exist
------Answer---------------Other answers (2 points)---------
-
Java Code
-
file F = new file ("C:/1.txt"), if (!f.exists ()) {try {f.createnewfile ();} catch (IOException e) {E.printstacktrac E (); } }
------Other answers (18 points)---------
-
Java Code
-
File File = new file ("C:\\123\\123.txt"), if (!file.getparentfile (). exists ()) File.getparentfile (). Mkdirs (); File.createnewfile ();
------Answer---------
------Other answers (2 points)---------
-
Java Code
-
file F = new file ("C:/1.txt"), if (!f.exists ()) {try {f.createnewfile ();} catch (IOException e) {E.printstacktrac E (); } }
------Other answers (18 points)---------
-
Java Code
-
File File = new file ("C:\\123\\123.txt"), if (!file.getparentfile (). exists ()) File.getparentfile (). mkdirs (); file. CreateNewFile (); http://biancheng.dnbcw.net/java/180676.html http://biancheng.dnbcw.net/java/
How to create a file with a path in Java