创建File时遇见了一个怪异的问题: (这些代码都在同一个源文件中,要失败应该都失败才是。。) 创建文件: File file = new File(“folder1/folder2/a.dat”); //可以创建成功 File file = new File("/folder1/folder2/a.dat"); //创建失败 File file = new File("./folder1/folder2/a.dat"); //可以创建成功
如新建文件夹: File file = new File(“folder1/folder2/”); //可以创建成功 File file = new File(“/folder1/folder2”); //创建成功 File file = new File(“./folder1/folder2”); //可以创建成功
问什么创建文件夹的时候前面加/后可以成功!!!而创建文件的时候去失败???
|