JavaAPI-System 类
一、System 类
1.1、System 类概述
- System 类在 java.lang 包下不需要导包
- System 类包含几个有用的类字段和方法。它不能被实例化。
1.2、常用方法
| 方法名 | 说明 |
|---|---|
| public static void exit(int status) | 终止当前运行的 Java 虚拟机,非零表示异常终止 |
| public static long currentTimeMillis() | 返回当前时间(以毫秒为单位) |
1.2.1、exit(int status) 方法
- 终止当前运行的 Java 虚拟机,非零表示异常终止。
System.exit(0);
1.2.2、currentTimeMillis()方法
- 返回当前时间(以毫秒为单位)。
System.out.println(System.currentTimeMillis());

浙公网安备 33010602011771号