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发行说明。
Every type is either a reference or a primitive. 每种类型要么是引用,要么是基元。Classes, enums, and arrays (which all inherit from 类、枚举和数组(都继承自java.lang.Object
) as well as interfaces are all reference types. java.lang.Object
)以及接口都是引用类型。Examples of reference types include 引用类型的示例包括java.lang.String
, all of the wrapper classes for primitive types such as java.lang.Double
, the interface java.io.Serializable
, and the enum javax.swing.SortOrder
. java.lang.String
、java.lang.Double
等基本类型的所有包装器类、接口java.io.Serializable
和枚举javax.swing.SortOrder
。There is a fixed set of primitive types: 有一组固定的基本类型:boolean
, byte
, short
, int
, long
, char
, float
, and double
.boolean
、byte
、short
、int
、long
、char
、float
和double
。
For every type of object, the Java virtual machine instantiates an immutable instance of 对于每种类型的对象,Java虚拟机都会实例化java.lang.Class
which provides methods to examine the runtime properties of the object including its members and type information. java.lang.Class
的一个不可变实例,该实例提供了检查对象的运行时属性(包括其成员和类型信息)的方法。Class
also provides the ability to create new classes and objects. 还提供了创建新类和对象的能力。Most importantly, it is the entry point for all of the Reflection APIs. 最重要的是,它是所有反射API的入口点。This lesson covers the most commonly used reflection operations involving classes:本课程介绍了最常用的涉及类的反射操作:
Class
Class
的方法Class
Class
时遇到的常见错误