adsense


Showing posts with label JAVA examples directory modification time. Show all posts
Showing posts with label JAVA examples directory modification time. Show all posts

Wednesday, 28 October 2015

JAVA examples directory modification time page 106

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



JAVA examples directory modification time







Java Examples - Directory Modification Time


Problem Description:
How to print the last modification time of a directory?
Solution:
Following example demonstrates how to get the last modification time of a directory with the help of 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("C://FileIO//demo.txt");
      System.out.println("last modifed:" + 
      new Date(file.lastModified()));
   }
}
Result:
The above code sample will produce the following result.
last modifed:10:20:54