Pregunta de entrevista de KOBIL Systems

How does garbage collection work in Java?