AMD interview question

How does garbage collection work in Java versus Python