This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
As we know that instance variable and object are stored on the heap memory where as local variable and method are stored on the stack.
But here i am thinking that why these difrence has been made that some are stored on heap and some are stored on stack. why not these are stored either on stack or heap. what benfit we will get by creating heap or stack. please specify me.