最近用到...

解决方案 »

  1.   

    File isDirectory() 
    这个就OK
      

  2.   


    File file = new File(".");
    System.out.println("File isExist: " +file.exists());
      

  3.   


    String path="你的路径";
    File file = new File(path);
    boolean b = file.isDirectory();
      

  4.   

    File exists()
    File isDirectory() 
      

  5.   

    isDirectory()
    文件存在且为一个目录时返回true
      

  6.   


    He wants to know whether the file exists or not...
    So:if ((yourFile.isDirectory()) && (yourFile.exists()))
      

  7.   


     File file = new File(path);
                if (!file.exists())
                {
                    System.err.println("文件不存在");
                    file.createNewFile();// 不存在则创建
                    System.err.println("文件创建");
                }
      

  8.   

    File类:
    boolean exists()  //文件或者是目录存在
    boolean isDirectory()  //File是否是目录
    boolean isFile()  //File是否是文件查File类API
      

  9.   

    file.exists()
    这个是file一个方法??