~/ learn/ comp-308/ cards/ COMP 308 — Java for Programmers
1 of 320

Type an aliasing assignment (two references, one object)

Type an aliasing assignment (two references, one object)

Answer

StringBuilder b = a;

Copies the reference, not the object. b and a now refer to the same heap object, so a change through one is seen through the other.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/d631c3a7-1877-4465-824a-cf30a492963a/flashcard utf-8 LF