Value and Reference Types
A value type is a data type where a variable stores the actual value of the data. For example, an Integer uses 4 bytes to hold the value of a number. When you define a variable of type Integer, the variable’s memory location holds the value.
In contrast, a reference type is a data type where a variable holds a reference pointing to some other location in memory that holds the actual data. String is a reference type because a String variable doesn’t actually hold the characters in the string. Instead, it holds a reference to a position in memory that holds the characters.
Classes are also reference types. That means a variable with a class type actually holds only a reference to a piece of memory that holds the object’s ...