The lastModified() method returns the time of the last file modification.
2. Method signature
- method does not take any parameter
- long - a value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs
- SecurityException - when we do not have access to the file or directory
3.1. Prints the lastModified of a not existing file, a directory and existing file
In this article, we presented a way to check the last modification date using Java IO API. The lastModified method returns time in milliseconds that could be easily converted to the Java 8
Instant object using