Capgemini Interview Question

Explain how garbage collection works in Java