Perforce Software interview question

Explain Memory allocation in Java