A couple things happen, both to the ArrayList and the removed object.
When ArrayList.remove()
is called, it does indeed remove reference to that object, from the ArrayList. In addition, the contents proceeding the removed element are shifted down by one.
If there are no other remaining references to that object, the memory allocated for the object is now eligible to be freed in an automated process called Garbage Collection
Example:
ArrayList<Integer> example = otherArrayList; // {2,3,10,6}
example.remove(1); // Remove second element
System.out.println(example.toString());
> [2, 10, 6]
// The space to which '3' is allocated to is now eligible for GC
Example of an object being ineligible for GC:
ArrayList<Integer> example = otherArrayList; // {2,3,10,6}
int ref = example.get(1); // '3' is assigned to ref
example.remove(1); // Remove second element
System.out.println(example.toString());
System.out.print(ref);
> [2, 10, 6]
> 3
/* Java is based on pass-by-value, but it passes references
when we pass existing object values. Which means the
address space allocated for ref (and formerly example.get(1))
is ineligible for GC.
*/