Cognizant interview question

Explain the concept and working of garbage collector in Java.