Spotify interview question

How does Java garbage collection work?