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 Java programming language uses both "fields" and "variables" as part of its terminology.Java编程语言使用“字段”和“变量”作为术语的一部分。Instance variables (non-static fields) are unique to each instance of a class.实例变量(非静态字段)对于类的每个实例都是唯一的。Class variables (static fields) are fields declared with the 类变量(静态字段)是使用静态修饰符声明的字段;不管类被实例化了多少次,类变量只有一个副本。static
modifier; there is exactly one copy of a class variable, regardless of how many times the class has been instantiated.Local variables store temporary state inside a method.局部变量在方法中存储临时状态。Parameters are variables that provide extra information to a method; both local variables and parameters are always classified as "variables" (not "fields").参数是为方法提供额外信息的变量;局部变量和参数始终分类为“变量”(而不是“字段”)。When naming your fields or variables, there are rules and conventions that you should (or must) follow.在命名字段或变量时,您应该(或必须)遵循一些规则和约定。
The eight primitive data types are: byte, short, int, long, float, double, boolean, and char.八种基本数据类型是:byte
、short
、int
、long
、float
、double
、boolean
和char
。The java.lang.String
class represents character strings.java.lang.String
类表示字符串。The compiler will assign a reasonable default value for fields of the above types; for local variables, a default value is never assigned.编译器将为上述类型的字段分配合理的默认值;对于局部变量,从不指定默认值。A literal is the source code representation of a fixed value.文本是固定值的源代码表示形式。An array is a container object that holds a fixed number of values of a single type.数组是一个容器对象,它包含固定数量的单一类型的值。The length of an array is established when the array is created.数组的长度是在创建数组时确定的。After creation, its length is fixed.创建后,其长度是固定的。