Java Tutorials - Herong's Tutorial Examples - v8.22, by Herong Yang
Reference Types Supported in Java
This section provides a list of reference types supported in Java: class type, interface type, type variable and null.
Other than primitive types, Java also supports several reference types as shown below:
Data Types | |- Primitive Types | |... | |- Reference Types | |- Class Type | |- Enum Type | |- Interface Type | |- Annotation Type | |- Type Variable | |- Array Type | |- null
1. Class Type - A class type is a reference type representing objects whose behaviors are defined in the corresponding class. For example, java.lang.String is a class type.
1.1. Enum Type - A enum type is a special kind of class type that has a set of pre-defined instances representing a set of static values called enum constants.
2. Interface Type - An interface type is a reference type representing objects whose behaviors are defined in the corresponding interface. For example, java.lang.Runnable is an interface type.
2.1. Annotation Type - A Annotation type is a special kind of interface type that defined by a "@interface" declaration statement (also called annotation declaration statement).
3. Type Variable - A type variable is a reference type representing objects whose type will be determined at execution time, not at the compilation time. Type variable is introduced in JDK 5 to create generic classes, generic interfaces and generic methods. For example, T is a type variable in "public class Box<T> {private T t;...}".
4. Array Type - An array type is a reference type representing objects of arrays of a primitive type or a reference type. For example, int[], String[] are array types.
5. null - null is a special reference type representing no object.
Table of Contents
Execution Process, Entry Point, Input and Output
Primitive Data Types and Literals
Bits, Bytes, Bitwise and Shift Operations
Managing Bit Strings in Byte Arrays
►Reference Data Types and Variables
►Reference Types Supported in Java
Class Type Variables Storing References
Explicit and Implicit Type Casting
Type Casting Compile and Runtime Error
StringBuffer - The String Buffer Class
System Properties and Runtime Object Methods
Generic Classes and Parameterized Types
Generic Methods and Type Inference
Lambda Expressions and Method References
Java Modules - Java Package Aggregation
Execution Threads and Multi-Threading Java Programs
ThreadGroup Class and "system" ThreadGroup Tree
Synchronization Technique and Synchronized Code Blocks
Deadlock Condition Example Programs
Garbage Collection and the gc() Method
Assert Statements and -ea" Option