Appinventiv interview question

how java gc works ?