
在JDK1.5+Eclipse3.2 下编译通过~
不过不能用URL判断WEB文唤顷件,只能坐毁指在服务器上啦~
import java.io.*;
import java.text.*;
import java.util.*;
public class checkfile {
public checkfile(){
}
public long cfile(String fPath){
File nf=new File(fPath);
if(nf.exists()){
return nf.lastModified();
}
return 0;
}
public static void main(String Args[]){
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String strBuf = null;
try{
strBuf = br.readLine();
}catch(IOException e){
e.printStackTrace();
}
checkfile cf=new checkfile();
SimpleDateFormat tm = new SimpleDateFormat("纤链配yyyy-mm-dd");
String tsm= tm.format(new Date(cf.cfile(strBuf.toString())));
System.out.println("LastModified Time:" + tsm);
}
}