Morgan Stanley interview question

How does the Java virtual Machine assign memory?