The Java Tutorials have been written for 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.
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.
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. 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
. There is a fixed set of primitive types: boolean
, byte
, short
, int
, long
, char
, float
, and double
.
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.
Class
also provides the ability to create new classes and objects. Most importantly, it is the entry point for all of the Reflection APIs. This lesson covers the most commonly used reflection operations involving classes:
Class
Class