Reference Data Types in Java
Reference Data Types in Java
JAVA - Programming
Fourth Grading
What is a reference data type in Java, and how do they differ from the primitive data type?
In Java, non-primitive data types are known as reference types. In other words, a variable
of class type is called reference data type. It contains the address (or reference) of dynamically
created objects. For example, if Demo is a class and we have created its object d, then the variable
d is known as a reference type.
It refers to objects. It is not pre-defined. It is created by the programmer if required. The
reference types hold the references of objects. All reference types are a subclass of type
java.lang.Object. It provides access to the objects stored in the memory. The examples of reference
data types are:
If there are no references to an object, the memory used by that object can be reclaimed
during the garbage collection process.
Reference/s:
https://www.javatpoint.com/reference-data-types-in-java