Pergunta de entrevista da empresa Infosys

How does Java handle memory management, and what is the difference between the stack and the heap? How does garbage collection work in Java, and what are the different types of garbage collectors available?