~/ 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/822b5f74-bc3d-4a47-9447-a8f9b68d9472/flashcard utf-8 LF