Redgate Software interview question

How garbage collection works in Java?