How to tell when a file was last modified?

Question:
How can you tell when a file was last updated in java?

Answer:
Use the File.lastModified() method.

Code:
import java.io.*;
import java.util.*;
 
public class FileModified {
   public static void main(String[] args) {
      File file = new File("FileModified.java");
      Date d = new Date(file.lastModified());
      System.out.println(d);
   }
}

Output:
$ java FileModified 
Fri Feb 28 06:59:28 EST 2014

$ ls -l FileModified.java 
-rw-r--r-- 1 dennis dennis 242 Feb 28 06:59 FileModified.java