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发行说明。
The Date-Time API offers a rich set of methods within a rich set of classes. 日期时间API在一组丰富的类中提供了一组丰富的方法。The method names are made consistent between classes wherever possible. 方法名称尽可能在类之间保持一致。For example, many of the classes offer a now method that captures the date or time values of the current moment that are relevant to that class. 例如,许多类提供了一个now方法,用于捕获与该类相关的当前时刻的日期或时间值。There are from methods that allow conversion from one class to another.有许多方法允许从一个类转换到另一个类。
There is also standardization regarding the method name prefixes. 还有关于方法名称前缀的标准化。Because most of the classes in the Date-Time API are immutable, the API does not include set methods. 因为日期时间API中的大多数类是不可变的,所以该API不包括set方法。(After its creation, the value of an immutable object cannot be changed. The immutable equivalent of a set method is with.) (创建后,不可变对象的值不能更改。set方法的不可变等价物是with。)The following table lists the commonly used prefixes:下表列出了常用的前缀:
of | ||
from | ||
parse | ||
format | ||
get | ||
is | ||
with | ||
plus | ||
minus | ||
to | ||
at |