IBM interview question

how does garbage collector in java work?