This example code compares the last modified date of two files and show to the console.

Java Code:
import java.io.File;

public class lastModified {

    public static void main(String[] args) {

        String s1 = "c:\\file1.txt";
        String s2 = "c:\\file2.txt";

        File f1 = new File(s1);
        File f2 = new File(s2);

        if (f1.lastModified() < f2.lastModified()) {
            System.out.println(s1 + " is older than " + s2);
            System.out.println(f1.lastModified());
            System.out.println(f2.lastModified());
        } else {
            System.out.println(s2 + " is older than " + s1);
        }
    }
}