Java 实例 - 获取文件修改时间

Java 教程 · 2019-02-10 22:59:17

以下实例演示了使用 File 类的 file.lastModified() 方法来获取文件最后的修改时间

Main.java 文件

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); } }

以上代码运行输出结果为:

Thu Apr 09 09:40:19 CST 2015

点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html

查看所有标签

A Common-Sense Guide to Data Structures and Algorithms

A Common-Sense Guide to Data Structures and Algorithms

Jay Wengrow / Pragmatic Bookshelf / 2017-8-13 / USD 45.95

If you last saw algorithms in a university course or at a job interview, you’re missing out on what they can do for your code. Learn different sorting and searching techniques, and when to use each. F......一起来看看 《A Common-Sense Guide to Data Structures and Algorithms》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

html转js在线工具
html转js在线工具

html转js在线工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具