When an object is assigned to a variable, this variable holds the reference to the memory where the object resides. From a practical standpoint, such a variable is handled in the code as if it is the object it represents. The type of such a variable can be a class, an interface, an array, or a special null type. If null is assigned, the reference to the object is lost and the variable does not represent any object. If an object is not used anymore, JVM removes it from the memory in the process called garbage collection. We will describe this process in Chapter 11, JVM Processes and Garbage Collection.
There is also a reference type called type variable used for the declaration of a type parameter of a generic class, interface, method, or constructor. It belongs to the area of Java generic programming that is outside of the scope of this book.
All...