Reference

A reference value points to a sequence of memory locations that may contain an object or array.

Related concepts:  ValueTypeObjectArrayPrimitive

Closest Wikipedia entry:  Reference (computer science) — In computer programming, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device. The reference is said to refer to the datum, and accessing the datum is called dereferencing the reference. A reference is distinct from the datum itself.

Authoritative Definition

Wikipedia does not necessarily offer the best fitting definition of a concept. The exact meaning we attribute to the concept of Reference is based on principled authoritative sources such as:

Misconceptions about Reference
29 documented Misconceptions

Check Yourself
Misconception
AssignmentCopiesObjectJava
Assignment copies the object
Misconception
AssignmentCopiesObjectJavaScript
Assignment copies the object
Misconception
AssignmentCopiesObjectPython
Assignment copies the object
Misconception
BoxedNullJava
Passing null to a wrapper class constructor creates an object representing the absence of a value
Misconception
ConstReferenceImpliesImmutabilityJavaScript
An object referred to by a const variable is an immutable object
Misconception
EqualityOperatorComparesListIdentitiesScratch
(list a) = (list b) compares the identities of list a and list b
Misconception
EqualityOperatorComparesObjectsValuesJava
o==p compares the objects referred to by variables o and p
Misconception
EqualityOperatorComparesObjectsValuesJavaScript
The equality operator compares two objects' values
Misconception
EqualsComparesReferencesJava
o.equals(p) compares the references stored in the variables o and p
Misconception
FinalReferenceImpliesImmutabilityJava
An object referred to by a final variable is an immutable object
Misconception
MultiReferenceVariableJava
A reference variable can point to multiple objects
Misconception
NullIsObjectJava
null is an object
Misconception
NullIsObjectJavaScript
null is an object
Misconception
ObjectAsParameterIsCopiedJavaScript
Objects are passed by value
Misconception
ReferenceIntoStackJava
References can point into the stack
Misconception
ReferenceLabeledWithDynamicTypeJava
In stack and heap diagrams, reference variables are labeled with the types of the objects they refer to
Misconception
ReferenceToBooleanCoercionJava
Every reference type can be coerced to boolean
Misconception
ReferenceToIntegerConversionJava
One can cast between references and ints
Misconception
ReferenceToVariableJava
References can point to variables
Misconception
SubtypeCompatibleWithSupertypeJava
A variable of a subtype can reference an object of a supertype
Misconception
SupertypeIncompatibleWithSubtypeJava
A variable of a supertype cannot reference an object of a subtype
Misconception
ThisAsFieldJava
this is a special field in the object
Misconception
ThisAssignableJava
One can assign to this
Misconception
ThisAssignableJavaScript
One can assign to this
Misconception
ThisCanBeNullJava
this can be null
Misconception
ThisExistsInStaticMethodJava
this is a local variable, also in static methods
Misconception
ThisInConstructorIsNullJava
In a constructor, this is null
Misconception
VariablesHoldObjectsJava
A variable of a reference type contains a whole object
Misconception
VariablesHoldObjectsPython
A variable contains a whole object

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.