Barclays interview question

How does Java do garbage collection?