Primitive data types vs.
reference data types
- Besides the
primitive
data types,
all other
data types
in Java
are
reference
data types
-
Reference:
- A reference
in computer science is
a
memory address
|
-
Reference
data type:
- A variable of a
reference data type
stores an
memory
address
|
- Examples of
reference
data type:
-
Variables of
primitive
data types and
reference
data types
are stored
differently
in Java
|
Storage of
variables of
primitive data types
- Variables of
primitive data types are
stored
as follows:
- The variable a
contains a
value of the
primitive data type
|
Storage of
variables of
reference data types
- Variables of
reference data types are
stored
as follows:
- The variable a contains
a
reference to
the location where the
(array) object is
stored
|
❮
❯