Morgan Stanley Interview Question

How does the Java virtual Machine assign memory?