最好的方法是:
String path = "C:" + File.separator + "hello" + File.separator + "hi.txt";// Use relative path for Unix systemsFile f = new File(path);f.getParentFile().mkdirs(); f.createNewFile();

最好的方法是:
String path = "C:" + File.separator + "hello" + File.separator + "hi.txt";// Use relative path for Unix systemsFile f = new File(path);f.getParentFile().mkdirs(); f.createNewFile();