Documentation

The Java™ Tutorials
Hide TOC
Classes
Trail: The Reflection API

Lesson: Classes课程:类

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.Stringjava.lang.Double等基本类型的所有包装器类、接口java.io.Serializable和枚举javax.swing.SortOrderThere is a fixed set of primitive types: boolean, byte, short, int, long, char, float, and double.有一组固定的基本类型:booleanbyteshortintlongcharfloatdouble

For every type of object, the Java virtual machine instantiates an immutable instance of java.lang.Class which provides methods to examine the runtime properties of the object including its members and type information. 对于每种类型的对象,Java虚拟机都会实例化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:本课程介绍了最常用的涉及类的反射操作:


Previous page: Table of Contents
Next page: Retrieving Class Objects