用File.canWrite();和File.calRead();
File file = new File("c:\dtd.txt");
if (file.canWrite()
   System.out.println("可写");
if (file.canRead())
   System.out.println("可读");

解决方案 »

  1.   

    File类有这两个方法。 
    boolean canRead() 
              Tests whether the application can read the file denoted by this abstract pathname. 
     boolean canWrite() 
              Tests whether the application can modify to the file denoted by this abstract pathname. 
    有个FilePermission类不知道能不能满足你的要求。自己多写点程序试试吧。
      

  2.   

    File里有个方法:File.setReadOnly();
    可以将文件属性设置为只读,但是反过来,将只读改为可写,这个方法好像还没有,至少我还没有发现。