Altice interview question

How java's automatic memory management works