adsense


Showing posts with label JAVA EXAMPLES FILE MODIFICATION DATE. Show all posts
Showing posts with label JAVA EXAMPLES FILE MODIFICATION DATE. Show all posts

Monday, 26 October 2015

JAVA EXAMPLES FILE MODIFICATION DATE PAGE 89

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



JAVA EXAMPLES FILE MODIFICATION DATE



Java Examples - File Modification Date


Problem Description:
How to get last modification date of a file ?
Solution:
This example shows how to get the last modification date of a file using file.lastModified() method of File class.
import java.io.File;
import java.util.Date;

public class Main {
   public static void main(String[] args) {
      File file = new File("Main.java");
      Long lastModified = file.lastModified();
      Date date = new Date(lastModified);
      System.out.println(date);
   }
}
Result:
The above code sample will produce the following result.
Tue 12 May 10:18:50 PDF 2009