java的File类的lastModified()方法可以返回文件的最后修改时间:
String s1 = "file1.dat"; String s2 = "file2.dat"; File f1 = new File(s1); File f2 = new File(s2); if (f1.lastModified() < f2.lastModified()) System.out.println((s1 + " IS OLDER THAN " + S2);
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/10435.html