你用
String filename = File.separator+"data"+File.separator+"temp.txt";
File pMap=new File(filename);
试试

解决方案 »

  1.   

    :)
    你最好先用File.exists()检查一下文件是否存在……还有你是否对文件有读的权限,不然取到的就是0L……
    用法没什么问题……
      

  2.   

    File pMap=new File("//data//temp.txt");
    Date fileDate=new Date(pMap.lastModified());
      

  3.   

    两位兄长的方法我都试过了,结果发现pMap.exists()果然返回值为false.看来应是文件路径写的有问题了,我再改一改。:)