|NO.Z.00034|——————————|BigDataEnd|——|Java&核心类库.V04|——|Java.v04|System类|概念使用|Java8之前|日期相关类|
一、[System类的概念和使用]——Java8之前的日期相关类(熟悉)
### --- System类的概述
~~~ # 基本概念
~~~ ——> Java.lang.System类中提供了一些有用的类字段和方法。
二、常用的方法
方法声明 | 功能介绍 |
static longcurrentTimeMillis() | 返回当前时间与1970年1月1日0时0分0秒之间以毫秒为单位的时间差 |
三、编程代码
package com.yanqi.task13;
public class SystemTest {
public static void main(String[] args) {
// 1.获取当前系统时间距离1970年1月1日0时0分0秒的毫秒数
long msec = System.currentTimeMillis();
System.out.println("当前系统时间距离1970年1月1日0时0分0秒已经过去" + msec + "毫秒了!");
// 通常用于测试某一段代码的执行效率
}
}
四、编译打印
D:\JAVA\jdk-11.0.2\bin\java.exe "-javaagent:D:\IntelliJIDEA\IntelliJ IDEA 2019.3.3\lib\idea_rt.jar=61916:D:\IntelliJIDEA\IntelliJ IDEA 2019.3.3\bin" -Dfile.encoding=UTF-8 -classpath E:\NO.Z.10000——javaproject\NO.H.00001.javase\javase\out\production\javase com.yanqi.task13.SystemTest
当前系统时间距离1970年1月1日0时0分0秒已经过去1627645788127毫秒了!
Process finished with exit code 0
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor