~/ learn/ comp-308/ cards/ Java objects & references (recap)
1 of 5

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/f18ed4fa-9592-4f37-9968-d0069ddd3033/flashcard utf-8 LF