Reference Types Supported in Java

This section provides a list of reference types supported in Java: class type, interace 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 Or Interface Type
   |  |- Class Type
   |  |- Interface 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.

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.

3. Type Variable - A type variable type is a reference type representing objects whose type will be determined as 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.

Last update: 2014.

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows

 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

 Creating Class Type Objects

 Class Type Variables Storing References

 Interface Type Variables

 Class and Interface Hierarchy

 Supertype and Subtype

 Explicit and Implicit Type Casting

 Type Casting Example Program

 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

 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

 Outdated Tutorials

 References

 PDF Printing Version