假设A是绝对路径。
String path = A + "\" + B;
File tempFile = new File(path);
if (tempFile.exists()) {
  存在
} else {
  不存在
}

解决方案 »

  1.   

    如果运行在A下,能否直接
    File tempFile = new File(“\\B”);
    if (tempFile.exists()) {
      存在
    } else {
      不存在
    }还有A + "\" + B;
    用不用A + "\\" + B;
      

  2.   

    String path ="c:\aaa";
    File Filepath=new File(path);
    if(!Filepath.exists()) 
        Filepath.mkdir();
    如果c:\aaa不存在则加一个
      

  3.   

    当然也是可以的了。
    JAVA默认的目录分隔符的确是"\\",不过好像有些情况下两个都能用!嗬嗬!你自己试试吧!