That's not how references work.
Child child1 = new Child();
creates a reference to a new Child
object
Child child2 = child1;
Creates another reference that points to the same object that child1
does
child1 = null;
Sets the child1
reference to null
(it no longer points to anything). It does not change the object it pointed to and does not affect child2
. child2
still points to the same object it did before.