Capgemini interview question

How memory is managed in JAVA programming?