Pregunta de entrevista de IBM

how does garbage collector in java work?