Capgemini Interview Question

How memory is managed in JAVA programming?