title: Why heaps are used for managing object references in java?
body: <p>Functions and variables are stored on stack while string and object references are stored on heap. Why is there a difference on how they are stored?</p>