Pregunta de entrevista de Spotify

How does Java garbage collection work?