Domanda di colloquio di Morgan Stanley

How does the garbage collection work in Java? Can you explain one of the methods the GC uses?