假设A是绝对路径。
String path = A + "\" + B;
File tempFile = new File(path);
if (tempFile.exists()) {
存在
} else {
不存在
}
String path = A + "\" + B;
File tempFile = new File(path);
if (tempFile.exists()) {
存在
} else {
不存在
}
File tempFile = new File(“\\B”);
if (tempFile.exists()) {
存在
} else {
不存在
}还有A + "\" + B;
用不用A + "\\" + B;
File Filepath=new File(path);
if(!Filepath.exists())
Filepath.mkdir();
如果c:\aaa不存在则加一个
JAVA默认的目录分隔符的确是"\\",不过好像有些情况下两个都能用!嗬嗬!你自己试试吧!