While reference-type variables refer to a place in memory, value-type variables hold the actual data.

Let’s put that into practice with a little code.



Create a Book variable bookLocation that refers to a new Book object.

The variable is a reference to the object’s location in memory.


Create another Book variable named sameBookLocation and set it equal to bookLocation.

Both variables refer to the same location in memory.


Create a bool variable falseValue that refers to the boolean value false.

The variable holds the actual value.


Create another bool variable anotherFalseValue and set it equal to falseValue.

The false value was copied to a new location in memory for anotherFalseValue to use.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?