The Java Tutorials have been written for JDK 8.Java教程是为JDK 8编写的。Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.本页中描述的示例和实践没有利用后续版本中引入的改进,并且可能使用不再可用的技术。See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.有关Java SE 9及其后续版本中更新的语言特性的摘要,请参阅Java语言更改。
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.有关所有JDK版本的新功能、增强功能以及已删除或不推荐的选项的信息,请参阅JDK发行说明。
This section describes some of the methods in 本节介绍System
that aren't covered in the previous sections.System
中的一些方法,这些方法在前面的章节中没有介绍。
The arrayCopy
method efficiently copies data between arrays. For more information, refer to Arrays in the Language Basics lesson.
The currentTimeMillis
and nanoTime
methods are useful for measuring time intervals during execution of an application. To measure a time interval in milliseconds, invoke currentTimeMillis
twice, at the beginning and end of the interval, and subtract the first value returned from the second. Similarly, invoking nanoTime
twice measures an interval in nanoseconds.
currentTimeMillis
and nanoTime
is limited by the time services provided by the operating system. Do not assume that currentTimeMillis
is accurate to the nearest millisecond or that nanoTime
is accurate to the nearest nanosecond. Also, neither currentTimeMillis
nor nanoTime
should be used to determine the current time. Use a high-level method, such as java.util.Calendar.getInstance
. The exit
method causes the Java virtual machine to shut down, with an integer exit status specified by the argument. The exit status is available to the process that launched the application. 退出状态可用于启动应用程序的进程。By convention, an exit status of 按照惯例,退出状态为0
indicates normal termination of the application, while any other value is an error code.0
表示应用程序正常终止,而任何其他值都是错误代码。