~/ 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/77ba4984-c9cb-4e14-aa07-2d8cf7ed3b05/flashcard utf-8 LF