Appinventiv Interview Question

how java gc works ?