Pointers, links, object and reference count
- by EugeneP
String a = "a"; // allocate memory and write address of a memory block to a variable
String b = "b";
// in a and b hold addresses
b = a; // copy a address into b.
// Now what? b value is completely lost and will be garbage collected
//* next step
a = null; // now a does not hold a valid address to any data,
// still data of a object exist…